From: Pasi Kallinen Date: Sat, 31 Oct 2015 22:28:28 +0000 (+0200) Subject: Fix lev_comp memory leaks X-Git-Tag: NetHack-3.6.0_RC01~116 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b0e4357c32f5fd004e72361bf24815af208b4f75;p=nethack Fix lev_comp memory leaks --- diff --git a/util/lev_comp.y b/util/lev_comp.y index 5d777d44d..91d46a161 100644 --- a/util/lev_comp.y +++ b/util/lev_comp.y @@ -1518,6 +1518,7 @@ seen_trap_mask : STRING int token = get_trap_type($1); if (token == ERR || token == 0) lc_error("Unknown trap type '%s'!", $1); + Free($1); $$ = (1L << (token - 1)); } | ALL_ID @@ -1532,7 +1533,7 @@ seen_trap_mask : STRING if ((1L << (token - 1)) & $3) lc_error("Monster seen_traps, trap '%s' listed twice.", $1); - + Free($1); $$ = ((1L << (token - 1)) | $3); } ; @@ -2205,6 +2206,7 @@ encodemonster : STRING $$ = -1; } else $$ = SP_MONST_PACK(m, def_monsyms[(int)mons[m].mlet].sym); + Free($1); } | CHAR { @@ -2223,6 +2225,7 @@ encodemonster : STRING $$ = -1; } else $$ = SP_MONST_PACK(m, $2); + Free($4); } | RANDOM_TYPE { @@ -2258,7 +2261,7 @@ encodeobj : STRING $$ = -1; } else $$ = SP_OBJ_PACK(m, 1); /* obj class != 0 to force generation of a specific item */ - + Free($1); } | CHAR { @@ -2277,6 +2280,7 @@ encodeobj : STRING $$ = -1; } else $$ = SP_OBJ_PACK(m, $2); + Free($4); } | RANDOM_TYPE {