]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: fix memleak in routing policy
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 1 Nov 2018 14:24:17 +0000 (23:24 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 1 Nov 2018 14:24:20 +0000 (23:24 +0900)
As set_put() may fail if input is duplicated.

src/network/networkd-routing-policy-rule.c

index 28a2a0fcbff085c12a9d33c3195f57299caae6b7..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;
 }