mirror of
https://github.com/systemd/systemd.git
synced 2025-01-24 06:04:05 +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)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
|
|
||||||
rule->manager = m;
|
|
||||||
|
|
||||||
r = routing_policy_rule_copy(rule, in);
|
r = routing_policy_rule_copy(rule, in);
|
||||||
if (r < 0)
|
if (r < 0)
|
||||||
return r;
|
return r;
|
||||||
@ -357,6 +355,8 @@ static int routing_policy_rule_add_internal(Manager *m, Set **rules, const Routi
|
|||||||
if (r == 0)
|
if (r == 0)
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
|
|
||||||
|
rule->manager = m;
|
||||||
|
|
||||||
if (ret)
|
if (ret)
|
||||||
*ret = rule;
|
*ret = rule;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user