resolved: fix memleak on duplicate host lines in /etc/hosts

This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2020-06-05 14:03:30 +02:00
parent ceb17827fa
commit ab9dd0b997
1 changed files with 1 additions and 2 deletions

View File

@ -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;
}