From 201bfb98033aed853b10899f0b190b875674b16c Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Sun, 28 Oct 2012 15:28:39 +0100 Subject: [PATCH] When erroring while parsing a function and the function had been added to the parser's function list, remove it, otherwise it'll get freed again in the parser's cleanup function --- parser.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/parser.c b/parser.c index d865212..4ef7a07 100644 --- a/parser.c +++ b/parser.c @@ -2197,12 +2197,12 @@ static bool parse_function_body(parser_t *parser, ast_value *var) parser->function = func; if (!parse_block_into(parser, block, true)) { ast_block_delete(block); - goto enderrfn; + goto enderrfn2; } if (!ast_function_blocks_add(func, block)) { ast_block_delete(block); - goto enderrfn; + goto enderrfn2; } parser->function = old; @@ -2215,6 +2215,8 @@ static bool parse_function_body(parser_t *parser, ast_value *var) parseerror(parser, "missing semicolon after function body (mandatory with -std=qcc)"); return retval; +enderrfn2: + parser->functions_count--; enderrfn: ast_function_delete(func); var->constval.vfunc = NULL; -- 2.39.2