summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2020-12-29 18:11:32 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2020-12-29 18:11:36 +0100
commitfdce9324c7132a9a6d3b2fe9f8449dcfc8309114 (patch)
tree728a320363144039ac885024fca1b3adb58ccd7f /src
parentnetwork: constify several arguments (diff)
downloadsystemd-fdce9324c7132a9a6d3b2fe9f8449dcfc8309114.tar.xz
systemd-fdce9324c7132a9a6d3b2fe9f8449dcfc8309114.zip
network: fix possible memory leak
When set_put() returns 0, then already stored rule will be unref()ed from Manager.
Diffstat (limited to 'src')
-rw-r--r--src/network/networkd-routing-policy-rule.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/network/networkd-routing-policy-rule.c b/src/network/networkd-routing-policy-rule.c
index bb1c77ad26..723a44cb6d 100644
--- a/src/network/networkd-routing-policy-rule.c
+++ b/src/network/networkd-routing-policy-rule.c
@@ -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;