mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-02-04 17:47:03 +03:00
resolved: fix memleak on duplicate host lines in /etc/hosts
This commit is contained in:
parent
ceb17827fa
commit
ab9dd0b997
@ -120,11 +120,10 @@ static int parse_line(EtcHosts *hosts, unsigned nr, const char *line) {
|
||||
/* Optimize the case where we don't need to store any addresses, by storing
|
||||
* only the name in a dedicated Set instead of the hashmap */
|
||||
|
||||
r = set_ensure_put(&hosts->no_address, &dns_name_hash_ops, name);
|
||||
r = set_ensure_consume(&hosts->no_address, &dns_name_hash_ops, TAKE_PTR(name));
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
TAKE_PTR(name);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user