]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables: Add a few missing exit calls
authorPhil Sutter <phil@nwl.cc>
Thu, 23 Aug 2018 15:43:24 +0000 (17:43 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 24 Aug 2018 08:05:51 +0000 (10:05 +0200)
Mostly to reduce noise from valgrind output, add missing calls to
destroy iterators in nft.c and add cleanup for the populated nft_handle
in xtables_eb_save_main().

Signed-off-by: Phil Sutter <phil@nwl.cc>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
iptables/nft.c
iptables/xtables-save.c

index dd8469a920dcc316a05caa5a9019790f407950a8..b2165069c6d89660ec2a6d1cdfbab2a06f108dfb 100644 (file)
@@ -1830,12 +1830,15 @@ bool nft_table_find(struct nft_handle *h, const char *tablename)
                const char *this_tablename =
                        nftnl_table_get(t, NFTNL_TABLE_NAME);
 
-               if (strcmp(tablename, this_tablename) == 0)
-                       return true;
+               if (strcmp(tablename, this_tablename) == 0) {
+                       ret = true;
+                       break;
+               }
 
                t = nftnl_table_list_iter_next(iter);
        }
 
+       nftnl_table_list_iter_destroy(iter);
        nftnl_table_list_free(list);
 
 err:
@@ -1868,6 +1871,7 @@ int nft_for_each_table(struct nft_handle *h,
                t = nftnl_table_list_iter_next(iter);
        }
 
+       nftnl_table_list_iter_destroy(iter);
        nftnl_table_list_free(list);
        return 0;
 }
index fc51fcfeb5815749d081ece9bee0ce7ada8e743c..182ae13c276f4c3d7524e78e1329faccc44e9281 100644 (file)
@@ -285,6 +285,7 @@ int xtables_eb_save_main(int argc_, char *argv_[])
        }
 
        nft_for_each_table(&h, __ebt_save, !!ctr);
+       nft_fini(&h);
        return 0;
 }