From: Wolfgang (Blub) Bumiller Date: Sun, 28 Oct 2012 14:28:39 +0000 (+0100) Subject: When erroring while parsing a function and the function had been added to the parser... X-Git-Tag: 0.1-rc1~21 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=201bfb98033aed853b10899f0b190b875674b16c;p=xonotic%2Fgmqcc.git 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 --- 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;