summaryrefslogtreecommitdiffstats
path: root/src/libnftables.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2018-10-12 13:22:55 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2018-10-15 13:37:51 +0200
commita56fe55dbd3232e70514610a1c2df1d6b15b931f (patch)
tree754202fa7ec5a09601a728c3244ea339fcd1d78e /src/libnftables.c
parent30541cb66e2de38eea04ab28cb14f298cce9d99f (diff)
libnftables: Fix memleak in nft_parse_bison_filename()
Allocated scanner object leaks when returning to caller. For some odd reason, this was missed by the commit referenced below. Fixes: bd82e03e15df8 ("libnftables: Move scanner object into struct nft_ctx") Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/libnftables.c')
-rw-r--r--src/libnftables.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/libnftables.c b/src/libnftables.c
index 656b0a1c..97776379 100644
--- a/src/libnftables.c
+++ b/src/libnftables.c
@@ -420,15 +420,14 @@ static int nft_parse_bison_filename(struct nft_ctx *nft, const char *filename,
struct list_head *msgs, struct list_head *cmds)
{
struct cmd *cmd;
- void *scanner;
int ret;
parser_init(nft, nft->state, msgs, cmds);
- scanner = scanner_init(nft->state);
- if (scanner_read_file(scanner, filename, &internal_location) < 0)
+ nft->scanner = scanner_init(nft->state);
+ if (scanner_read_file(nft->scanner, filename, &internal_location) < 0)
return -1;
- ret = nft_parse(nft, scanner, nft->state);
+ ret = nft_parse(nft, nft->scanner, nft->state);
if (ret != 0 || nft->state->nerrs > 0)
return -1;