]> git.puffer.fish Git - matthieu/frr.git/commitdiff
zebra: When removing a rule, release from hash storing it.
authorDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Mar 2018 21:00:19 +0000 (17:00 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Thu, 22 Mar 2018 21:02:31 +0000 (17:02 -0400)
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 <sharpd@cumulusnetworks.com>
zebra/zebra_pbr.c

index a9bc8450eeb499c36d7f511815354ab487333148..4b931688468c6b1947eb8efdb12b1f45b3ccaf01 100644 (file)
@@ -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);
        }
 }