network: fix memleak in routing policy

As set_put() may fail if input is duplicated.
This commit is contained in:
Yu Watanabe 2018-11-01 23:24:17 +09:00
parent 744faf5e4e
commit a6276f0f3f

View 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;
}