summaryrefslogtreecommitdiffstats
path: root/src/libnftables.c
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@netfilter.org>2019-09-27 08:37:12 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2019-09-27 08:41:58 +0200
commit11c0d38e18db57c405bcc9415d03e9e40aeac597 (patch)
tree7ea1734f5222ad54efec512aba44590cd2617d65 /src/libnftables.c
parentadb6170abf58196d8b83eb07f043dafef2c2945a (diff)
libnftables: memleak when list of commands is empty
==9946== 200,807 (40 direct, 200,767 indirect) bytes in 1 blocks are definitely lost in loss record 4 of 4 ==9946== at 0x4837B65: calloc (vg_replace_malloc.c:762) ==9946== by 0x4F28216: nftnl_batch_alloc (batch.c:66) ==9946== by 0x48A33E8: mnl_batch_init (mnl.c:164) ==9946== by 0x48A736F: nft_netlink.isra.0 (libnftables.c:29) ==9946== by 0x48A7D03: nft_run_cmd_from_filename (libnftables.c:508) ==9946== by 0x10A621: main (main.c:328) Fixes: fc6d0f8b0cb1 ("libnftables: get rid of repeated initialization of netlink_ctx") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/libnftables.c')
-rw-r--r--src/libnftables.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libnftables.c b/src/libnftables.c
index a19636b2..e2037243 100644
--- a/src/libnftables.c
+++ b/src/libnftables.c
@@ -34,7 +34,7 @@ static int nft_netlink(struct nft_ctx *nft,
int ret = 0;
if (list_empty(cmds))
- return 0;
+ goto out;
batch_seqnum = mnl_batch_begin(ctx.batch, mnl_seqnum_alloc(&seqnum));
list_for_each_entry(cmd, cmds, list) {