]> git.ipfire.org Git - thirdparty/nftables.git/commitdiff
rule: Free table->objs in table_free()
authorPhil Sutter <phil@nwl.cc>
Fri, 13 Apr 2018 14:52:26 +0000 (16:52 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Sat, 14 Apr 2018 11:53:02 +0000 (13:53 +0200)
This fixes a memory leak identified by valgrind.

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
src/rule.c

index c65600364e7d49a8da93fce8ffafa8e4c3b00791..3066145747707eeec29d5d92446b65ff8206b7cb 100644 (file)
@@ -812,6 +812,7 @@ void table_free(struct table *table)
 {
        struct chain *chain, *next;
        struct set *set, *nset;
+       struct obj *obj, *nobj;
 
        if (--table->refcnt > 0)
                return;
@@ -819,6 +820,8 @@ void table_free(struct table *table)
                chain_free(chain);
        list_for_each_entry_safe(set, nset, &table->sets, list)
                set_free(set);
+       list_for_each_entry_safe(obj, nobj, &table->objs, list)
+               obj_free(obj);
        handle_free(&table->handle);
        scope_release(&table->scope);
        xfree(table);