diff options
-rw-r--r-- | src/network/networkd-manager.c | 6 | ||||
-rw-r--r-- | src/network/test-routing-policy-rule.c | 4 |
2 files changed, 4 insertions, 6 deletions
diff --git a/src/network/networkd-manager.c b/src/network/networkd-manager.c index 478fc090b1..527d2623ca 100644 --- a/src/network/networkd-manager.c +++ b/src/network/networkd-manager.c @@ -1223,7 +1223,6 @@ int manager_new(Manager **ret, sd_event *event) { } void manager_free(Manager *m) { - RoutingPolicyRule *rule; Network *network; NetDev *netdev; Link *link; @@ -1253,10 +1252,7 @@ void manager_free(Manager *m) { set_free(m->rules); set_free(m->rules_foreign); - while ((rule = set_steal_first(m->rules_saved))) - free(rule); - - set_free(m->rules_saved); + set_free_with_destructor(m->rules_saved, routing_policy_rule_free); sd_netlink_unref(m->rtnl); sd_event_unref(m->event); diff --git a/src/network/test-routing-policy-rule.c b/src/network/test-routing-policy-rule.c index fc6eb5626d..c29d134de2 100644 --- a/src/network/test-routing-policy-rule.c +++ b/src/network/test-routing-policy-rule.c @@ -34,7 +34,7 @@ static void test_rule_serialization(const char *title, const char *ruleset, cons const char *cmd; int fd, fd2, fd3; _cleanup_fclose_ FILE *f = NULL, *f2 = NULL, *f3 = NULL; - _cleanup_set_free_free_ Set *rules = NULL; + Set *rules = NULL; _cleanup_free_ char *buf = NULL; size_t buf_size; @@ -64,6 +64,8 @@ static void test_rule_serialization(const char *title, const char *ruleset, cons cmd = strjoina("diff -u ", pattern3, " ", pattern2); log_info("$ %s", cmd); assert_se(system(cmd) == 0); + + set_free_with_destructor(rules, routing_policy_rule_free); } int main(int argc, char **argv) { |