From: Wolfgang Bumiller Date: Wed, 11 Sep 2013 09:25:44 +0000 (+0200) Subject: fix: declaring locals with the name of a parameter now treats the parameter as the... X-Git-Tag: 0.3.5~98 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=35f9aef7295ed20c58aa812e106be921fa7e8acd;p=xonotic%2Fgmqcc.git 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 --- diff --git a/parser.c b/parser.c index d65eafe..e3b4d9a 100644 --- a/parser.c +++ b/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;