Skip to contentSkip to conversation

libnftables: memleak when no batch commands in list

PATCH New Pablo Neira Ayuso 1 participant 1 message Sep 27, 2019 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 libnftables: memleak when no batch commands in list

A ruleset listing triggers this bug.

Fixes fc6d0f8b0cb1 ("libnftables: get rid of repeated initialization of netlink_ctx")
---
 src/libnftables.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/libnftables.c +1 -1
index a19636b22683..e20372438db6 100644
@@ -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) {
Signature · 1 line
2.11.0