mirror of
https://github.com/systemd/systemd.git
synced 2025-01-07 21:18:41 +03:00
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:
parent
3141c81736
commit
fdce9324c7
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user