network: fix possible memory leak

When set_put() returns 0, then already stored rule will be unref()ed
from Manager.
This commit is contained in:
Yu Watanabe 2020-12-30 02:11:32 +09:00
parent 3141c81736
commit fdce9324c7
1 changed files with 2 additions and 2 deletions

View File

@ -343,8 +343,6 @@ static int routing_policy_rule_add_internal(Manager *m, Set **rules, const Routi
if (r < 0)
return r;
rule->manager = m;
r = routing_policy_rule_copy(rule, in);
if (r < 0)
return r;
@ -357,6 +355,8 @@ static int routing_policy_rule_add_internal(Manager *m, Set **rules, const Routi
if (r == 0)
return -EEXIST;
rule->manager = m;
if (ret)
*ret = rule;