From b0815fa4999c749d36f24d55a8f9dbcd0b869708 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Tue, 29 Sep 2020 15:36:53 +0900 Subject: [PATCH] network: make routing_policy_rule_free() returns NULL --- src/network/networkd-routing-policy-rule.c | 8 ++++---- src/network/networkd-routing-policy-rule.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/network/networkd-routing-policy-rule.c b/src/network/networkd-routing-policy-rule.c index ed13bd09b8..b3c9a7f3e8 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 4e8b191a16..143711623f 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);