From d5c52f7605f3fab914425950bc36851e550fa044 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Thu, 22 Mar 2018 17:00:19 -0400 Subject: [PATCH] zebra: When removing a rule, release from hash storing it. When we are removing a rule from the zns->rules_hash, free up the rule from the hash and free the memory. Signed-off-by: Donald Sharp --- zebra/zebra_pbr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/zebra/zebra_pbr.c b/zebra/zebra_pbr.c index a9bc8450ee..4b93168846 100644 --- a/zebra/zebra_pbr.c +++ b/zebra/zebra_pbr.c @@ -166,9 +166,10 @@ void zebra_pbr_del_rule(struct zebra_ns *zns, struct zebra_pbr_rule *rule) lookup = hash_lookup(zns->rules_hash, rule); kernel_del_pbr_rule(rule); - if (lookup) + if (lookup) { + hash_release(zns->rules_hash, lookup); XFREE(MTYPE_TMP, lookup); - else + } else zlog_warn("%s: Rule being deleted we know nothing about", __PRETTY_FUNCTION__); } @@ -182,6 +183,7 @@ static void zebra_pbr_cleanup_rules(struct hash_backet *b, void *data) if (rule->sock == *sock) { kernel_del_pbr_rule(rule); hash_release(zns->rules_hash, rule); + XFREE(MTYPE_TMP, rule); } } -- 2.39.5