From: PatR Date: Tue, 10 Nov 2015 03:11:41 +0000 (-0800) Subject: tiny symset memory leak X-Git-Tag: NetHack-3.6.0_RC01~54^2~44 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=85b234e1fc22c33057358f46c368439905ea6fc4;p=nethack tiny symset memory leak Symbol set names weren't being freed upon exit. --- diff --git a/include/extern.h b/include/extern.h index 8f6bb1c84..54c6ed2b3 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1446516834 2015/11/03 02:13:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.513 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1447124656 2015/11/10 03:04:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.515 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1638,6 +1638,7 @@ E void FDECL(set_option_mod_status, (const char *, int)); E int FDECL(add_autopickup_exception, (const char *)); E void NDECL(free_autopickup_exceptions); E int FDECL(load_symset, (const char *, int)); +E void NDECL(free_symsets); E void FDECL(parsesymbols, (char *)); E struct symparse *FDECL(match_sym, (char *)); E void NDECL(set_playmode); diff --git a/src/drawing.c b/src/drawing.c index 515872a2a..96bbd2da2 100644 --- a/src/drawing.c +++ b/src/drawing.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 drawing.c $NHDT-Date: 1446975466 2015/11/08 09:37:46 $ $NHDT-Branch: master $:$NHDT-Revision: 1.48 $ */ +/* NetHack 3.6 drawing.c $NHDT-Date: 1447124657 2015/11/10 03:04:17 $ $NHDT-Branch: master $:$NHDT-Revision: 1.49 $ */ /* Copyright (c) NetHack Development Team 1992. */ /* NetHack may be freely redistributed. See license for details. */ @@ -520,9 +520,7 @@ boolean name_too; free((genericptr_t) symset[which_set].desc); symset[which_set].desc = (char *) 0; - symset[which_set].nocolor = 0; symset[which_set].handling = H_UNK; - symset[which_set].desc = (char *) 0; symset[which_set].nocolor = 0; /* initialize restriction bits */ symset[which_set].primary = 0; diff --git a/src/options.c b/src/options.c index 140fb02da..dd3097f33 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 options.c $NHDT-Date: 1446854231 2015/11/06 23:57:11 $ $NHDT-Branch: master $:$NHDT-Revision: 1.236 $ */ +/* NetHack 3.6 options.c $NHDT-Date: 1447124657 2015/11/10 03:04:17 $ $NHDT-Branch: master $:$NHDT-Revision: 1.238 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -4933,6 +4933,17 @@ int which_set; return 1; } +void +free_symsets() +{ + clear_symsetentry(PRIMARY, TRUE); + clear_symsetentry(ROGUESET, TRUE); + + /* symset_list is cleaned up as soon as it's used, so we shouldn't + have to anything about it here */ + /* assert( symset_list == NULL ); */ +} + /* Parse the value of a SYMBOLS line from a config file */ void parsesymbols(opts) diff --git a/src/save.c b/src/save.c index 18d9a1534..dccd3a785 100644 --- a/src/save.c +++ b/src/save.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 save.c $NHDT-Date: 1446892456 2015/11/07 10:34:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.92 $ */ +/* NetHack 3.6 save.c $NHDT-Date: 1447124658 2015/11/10 03:04:18 $ $NHDT-Branch: master $:$NHDT-Revision: 1.93 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1396,6 +1396,7 @@ freedynamicdata() /* miscellaneous */ free_pickinv_cache(); + free_symsets(); #endif /* FREE_ALL_MEMORY */ #ifdef STATUS_VIA_WINDOWPORT status_finish();