mirror of
https://github.com/systemd/systemd.git
synced 2024-10-28 11:55:44 +03:00
network: fix potential memleaks related to set_put()
This commit is contained in:
parent
4c94a4c2d6
commit
75a302b561
@ -260,6 +260,8 @@ static int address_add_internal(Link *link, Set **addresses,
|
||||
r = set_put(*addresses, address);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
return -EEXIST;
|
||||
|
||||
address->link = link;
|
||||
|
||||
|
@ -1945,6 +1945,8 @@ static int link_append_to_master(Link *link, NetDev *netdev) {
|
||||
r = set_put(master->slaves, link);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
return 0;
|
||||
|
||||
link_ref(link);
|
||||
return 0;
|
||||
|
@ -399,6 +399,8 @@ static int route_add_internal(
|
||||
r = set_put(*routes, route);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
return -EEXIST;
|
||||
|
||||
route->link = link;
|
||||
|
||||
|
@ -209,7 +209,11 @@ int routing_policy_rule_make_local(Manager *m, RoutingPolicyRule *rule) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
return set_put(m->rules, rule);
|
||||
r = set_put(m->rules, rule);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
routing_policy_rule_free(rule);
|
||||
}
|
||||
|
||||
return -ENOENT;
|
||||
@ -265,6 +269,8 @@ static int routing_policy_rule_add_internal(Manager *m, Set **rules, RoutingPoli
|
||||
r = set_put(*rules, rule);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
return -EEXIST;
|
||||
|
||||
if (ret)
|
||||
*ret = rule;
|
||||
@ -1180,8 +1186,8 @@ int routing_policy_load_rules(const char *state_file, Set **rules) {
|
||||
log_warning_errno(r, "Failed to add RPDB rule to saved DB, ignoring: %s", p);
|
||||
continue;
|
||||
}
|
||||
|
||||
rule = NULL;
|
||||
if (r > 0)
|
||||
rule = NULL;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user