mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-02-01 04:10:42 +00:00
fix: declaring locals with the name of a parameter now treats the parameter as the local's prototype to avoid it being double-freed later
This commit is contained in:
parent
46fa12cb26
commit
35f9aef729
1 changed files with 2 additions and 1 deletions
3
parser.c
3
parser.c
|
@ -5221,6 +5221,7 @@ static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofield
|
|||
retval = false;
|
||||
goto cleanup;
|
||||
}
|
||||
/* doing this here as the above is just for a single scope */
|
||||
old = parser_find_local(parser, var->name, 0, &isparam);
|
||||
if (old && isparam) {
|
||||
if (parsewarning(parser, WARN_LOCAL_SHADOWS,
|
||||
|
@ -5234,7 +5235,7 @@ static bool parse_variable(parser_t *parser, ast_block *localblock, bool nofield
|
|||
if (OPTS_OPTION_U32(OPTION_STANDARD) != COMPILER_GMQCC) {
|
||||
ast_delete(var);
|
||||
if (ast_istype(old, ast_value))
|
||||
var = (ast_value*)old;
|
||||
var = proto = (ast_value*)old;
|
||||
else {
|
||||
var = NULL;
|
||||
goto skipvar;
|
||||
|
|
Loading…
Reference in a new issue