mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-17 09:02:25 +00:00
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
This commit is contained in:
parent
921bbd7a8a
commit
201bfb9803
1 changed files with 4 additions and 2 deletions
6
parser.c
6
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;
|
||||
|
|
Loading…
Reference in a new issue