network: fix memleak
authorYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 5 Nov 2019 00:39:44 +0000 (09:39 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 5 Nov 2019 00:41:03 +0000 (09:41 +0900)
src/network/networkd-network.c

index 5e82b3c..f6d02fb 100644 (file)
@@ -654,6 +654,9 @@ static Network *network_free(Network *network) {
         while ((prefix = network->static_prefixes))
                 prefix_free(prefix);
 
+        while ((prefix = network->static_route_prefixes))
+                route_prefix_free(prefix);
+
         while ((rule = network->rules))
                 routing_policy_rule_free(rule);
 
@@ -664,6 +667,7 @@ static Network *network_free(Network *network) {
         hashmap_free(network->neighbors_by_section);
         hashmap_free(network->address_labels_by_section);
         hashmap_free(network->prefixes_by_section);
+        hashmap_free(network->route_prefixes_by_section);
         hashmap_free(network->rules_by_section);
         ordered_hashmap_free_with_destructor(network->qdiscs_by_section, qdisc_free);