]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: make routing_policy_rule_free() returns NULL
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 29 Sep 2020 06:36:53 +0000 (15:36 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 6 Oct 2020 17:36:29 +0000 (02:36 +0900)
src/network/networkd-routing-policy-rule.c
src/network/networkd-routing-policy-rule.h

index ed13bd09b8366efc3bafa14bf6d3cfc0595f823b..b3c9a7f3e86ac841e65d5c6407e8678dc1c7bbb5 100644 (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) {
index 4e8b191a16754bd93f994508414a0c59694fa4a9..143711623f98f63cf7795f3fac524715ceed1c92 100644 (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);