From: Yu Watanabe Date: Tue, 29 Sep 2020 06:36:53 +0000 (+0900) Subject: network: make routing_policy_rule_free() returns NULL X-Git-Tag: v247-rc1~117^2~132 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b0815fa4999c749d36f24d55a8f9dbcd0b869708;p=thirdparty%2Fsystemd.git network: make routing_policy_rule_free() returns NULL --- diff --git a/src/network/networkd-routing-policy-rule.c b/src/network/networkd-routing-policy-rule.c index ed13bd09b83..b3c9a7f3e86 100644 --- a/src/network/networkd-routing-policy-rule.c +++ b/src/network/networkd-routing-policy-rule.c @@ -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) { diff --git a/src/network/networkd-routing-policy-rule.h b/src/network/networkd-routing-policy-rule.h index 4e8b191a167..143711623f9 100644 --- a/src/network/networkd-routing-policy-rule.h +++ b/src/network/networkd-routing-policy-rule.h @@ -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);