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

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