]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/network/networkd-routing-policy-rule.c
network: fix memleak in routing policy
[thirdparty/systemd.git] / src / network / networkd-routing-policy-rule.c
index d7c68c680fe4a37f295998bf181db8903f5fdaa9..9ce3acd80760f89109bf22ade375596c9505102c 100644 (file)
@@ -257,8 +257,8 @@ static int routing_policy_rule_add_internal(Manager *m,
         rule->tos = tos;
         rule->fwmark = fwmark;
         rule->table = table;
-        rule->iif = TAKE_PTR(iif);
-        rule->oif = TAKE_PTR(oif);
+        rule->iif = iif;
+        rule->oif = oif;
 
         r = set_ensure_allocated(rules, &routing_policy_rule_hash_ops);
         if (r < 0)
@@ -272,6 +272,7 @@ static int routing_policy_rule_add_internal(Manager *m,
                 *ret = rule;
 
         rule = NULL;
+        iif = oif = NULL;
 
         return 0;
 }
@@ -370,8 +371,8 @@ int routing_policy_rule_remove(RoutingPolicyRule *routing_policy_rule, Link *lin
                         return log_error_errno(r, "Could not set destination prefix length: %m");
         }
 
-        r = sd_netlink_call_async(link->manager->rtnl, m, callback,
-                                  link_netlink_destroy_callback, link, 0, NULL);
+        r = sd_netlink_call_async(link->manager->rtnl, NULL, m, callback,
+                                  link_netlink_destroy_callback, link, 0, __func__);
         if (r < 0)
                 return log_error_errno(r, "Could not send rtnetlink message: %m");
 
@@ -539,8 +540,8 @@ int routing_policy_rule_configure(RoutingPolicyRule *rule, Link *link, sd_netlin
 
         rule->link = link;
 
-        r = sd_netlink_call_async(link->manager->rtnl, m, callback,
-                                  link_netlink_destroy_callback, link, 0, NULL);
+        r = sd_netlink_call_async(link->manager->rtnl, NULL, m, callback,
+                                  link_netlink_destroy_callback, link, 0, __func__);
         if (r < 0)
                 return log_error_errno(r, "Could not send rtnetlink message: %m");