network: make routing_policy_rule_free() returns NULL

This commit is contained in:
Yu Watanabe 2020-09-29 15:36:53 +09:00
parent 816ef8d1da
commit b0815fa499
2 changed files with 5 additions and 5 deletions

View File

@ -84,10 +84,9 @@ static int routing_policy_rule_new_static(Network *network, const char *filename
return 0;
}
void routing_policy_rule_free(RoutingPolicyRule *rule) {
RoutingPolicyRule *routing_policy_rule_free(RoutingPolicyRule *rule) {
if (!rule)
return;
return NULL;
if (rule->network) {
LIST_REMOVE(rules, rule->network->rules, rule);
@ -108,7 +107,8 @@ void routing_policy_rule_free(RoutingPolicyRule *rule) {
network_config_section_free(rule->section);
free(rule->iif);
free(rule->oif);
free(rule);
return mfree(rule);
}
static int routing_policy_rule_copy(RoutingPolicyRule *dest, RoutingPolicyRule *src) {

View File

@ -57,7 +57,7 @@ struct RoutingPolicyRule {
};
int routing_policy_rule_new(RoutingPolicyRule **ret);
void routing_policy_rule_free(RoutingPolicyRule *rule);
RoutingPolicyRule *routing_policy_rule_free(RoutingPolicyRule *rule);
DEFINE_NETWORK_SECTION_FUNCTIONS(RoutingPolicyRule, routing_policy_rule_free);
int routing_policy_rule_section_verify(RoutingPolicyRule *rule);