diff options
author | Phil Sutter <phil@nwl.cc> | 2017-08-24 19:14:13 +0200 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2017-08-24 19:20:29 +0200 |
commit | d4344bd829c00523b80f09bebf2a70c588b64c2a (patch) | |
tree | 72cb7bef48f869120e7ea32f095811cd17d4eb41 /src/parser_bison.y | |
parent | c7beb7a633315d540bddd127948803a3b555d286 (diff) |
parser: Fix for memleak when commands fail
In case of failing command evaluation, commands need to be freed as
their memory becomes orphaned afterwards.
Signed-off-by: Phil Sutter <phil@nwl.cc>
Diffstat (limited to 'src/parser_bison.y')
-rw-r--r-- | src/parser_bison.y | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/parser_bison.y b/src/parser_bison.y index a8b71cdd..d149178c 100644 --- a/src/parser_bison.y +++ b/src/parser_bison.y @@ -692,6 +692,7 @@ input : /* empty */ list_add_tail(&$2->list, &list); if (cmd_evaluate(&state->ectx, $2) < 0) { + cmd_free($2); if (++state->nerrs == nft->parser_max_errors) YYABORT; } else @@ -758,6 +759,7 @@ line : common_block { $$ = NULL; } list_add_tail(&$1->list, &list); if (cmd_evaluate(&state->ectx, $1) < 0) { + cmd_free($1); if (++state->nerrs == nft->parser_max_errors) YYABORT; } else |