network: fix memleak in static prefix

The fix by 744faf5e4e is not perfect,
as the section leaks if `hashmap_put()` in `prefix_new_static()` fails.
This commit is contained in:
Yu Watanabe
2018-11-04 00:31:46 +09:00
parent 6f1a96ded4
commit ecee0abe77
+2 -3
View File
@@ -98,13 +98,12 @@ void prefix_free(Prefix *prefix) {
assert(prefix->network->n_static_prefixes > 0);
prefix->network->n_static_prefixes--;
if (prefix->section) {
if (prefix->section)
hashmap_remove(prefix->network->prefixes_by_section,
prefix->section);
network_config_section_free(prefix->section);
}
}
network_config_section_free(prefix->section);
prefix->radv_prefix = sd_radv_prefix_unref(prefix->radv_prefix);
free(prefix);