Blame SOURCES/0015-libnftables-Fix-memleak-in-nft_parse_bison_filename.patch

9ff721
From eb770d79146941ce975c7b7caa9372b380978f98 Mon Sep 17 00:00:00 2001
9ff721
From: Phil Sutter <phil@nwl.cc>
9ff721
Date: Fri, 12 Oct 2018 13:22:55 +0200
9ff721
Subject: [PATCH] libnftables: Fix memleak in nft_parse_bison_filename()
9ff721
9ff721
Allocated scanner object leaks when returning to caller. For some odd
9ff721
reason, this was missed by the commit referenced below.
9ff721
9ff721
Fixes: bd82e03e15df8 ("libnftables: Move scanner object into struct nft_ctx")
9ff721
Signed-off-by: Phil Sutter <phil@nwl.cc>
9ff721
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
9ff721
(cherry picked from commit a56fe55dbd3232e70514610a1c2df1d6b15b931f)
9ff721
Signed-off-by: Phil Sutter <psutter@redhat.com>
9ff721
---
9ff721
 src/libnftables.c | 7 +++----
9ff721
 1 file changed, 3 insertions(+), 4 deletions(-)
9ff721
9ff721
diff --git a/src/libnftables.c b/src/libnftables.c
9ff721
index 5bc7ba0d210ab..91af169ca7190 100644
9ff721
--- a/src/libnftables.c
9ff721
+++ b/src/libnftables.c
9ff721
@@ -418,15 +418,14 @@ static int nft_parse_bison_filename(struct nft_ctx *nft, const char *filename,
9ff721
 				    struct list_head *msgs, struct list_head *cmds)
9ff721
 {
9ff721
 	struct cmd *cmd;
9ff721
-	void *scanner;
9ff721
 	int ret;
9ff721
 
9ff721
 	parser_init(nft, nft->state, msgs, cmds);
9ff721
-	scanner = scanner_init(nft->state);
9ff721
-	if (scanner_read_file(scanner, filename, &internal_location) < 0)
9ff721
+	nft->scanner = scanner_init(nft->state);
9ff721
+	if (scanner_read_file(nft->scanner, filename, &internal_location) < 0)
9ff721
 		return -1;
9ff721
 
9ff721
-	ret = nft_parse(nft, scanner, nft->state);
9ff721
+	ret = nft_parse(nft, nft->scanner, nft->state);
9ff721
 	if (ret != 0 || nft->state->nerrs > 0)
9ff721
 		return -1;
9ff721
 
9ff721
-- 
bacbc8
2.21.0
9ff721