]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
network: fix double free on error path
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 4 Jun 2019 05:25:09 +0000 (14:25 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 4 Jun 2019 07:23:18 +0000 (16:23 +0900)
src/network/networkd-routing-policy-rule.c

index f6253215ed8869885663811917d636312d2a8c66..637f8d5966f8b621f6694908aa875ce30d5b79f8 100644 (file)
@@ -275,8 +275,8 @@ static int routing_policy_rule_add_internal(Manager *m,
         rule->tos = tos;
         rule->fwmark = fwmark;
         rule->table = table;
-        rule->iif = iif;
-        rule->oif = oif;
+        rule->iif = TAKE_PTR(iif);
+        rule->oif = TAKE_PTR(oif);
         rule->protocol = protocol;
         rule->sport = *sport;
         rule->dport = *dport;
@@ -292,9 +292,7 @@ static int routing_policy_rule_add_internal(Manager *m,
         if (ret)
                 *ret = rule;
 
-        rule = NULL;
-        iif = oif = NULL;
-
+        TAKE_PTR(rule);
         return 0;
 }