tiny symset memory leak

Symbol set names weren't being freed upon exit.
This commit is contained in:
PatR
2015-11-09 19:11:41 -08:00
parent 8f0252c5d8
commit 85b234e1fc
4 changed files with 17 additions and 6 deletions
+2 -1
View File
@@ -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. */ /* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */ /* 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 int FDECL(add_autopickup_exception, (const char *));
E void NDECL(free_autopickup_exceptions); E void NDECL(free_autopickup_exceptions);
E int FDECL(load_symset, (const char *, int)); E int FDECL(load_symset, (const char *, int));
E void NDECL(free_symsets);
E void FDECL(parsesymbols, (char *)); E void FDECL(parsesymbols, (char *));
E struct symparse *FDECL(match_sym, (char *)); E struct symparse *FDECL(match_sym, (char *));
E void NDECL(set_playmode); E void NDECL(set_playmode);
+1 -3
View File
@@ -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. */ /* Copyright (c) NetHack Development Team 1992. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -520,9 +520,7 @@ boolean name_too;
free((genericptr_t) symset[which_set].desc); free((genericptr_t) symset[which_set].desc);
symset[which_set].desc = (char *) 0; symset[which_set].desc = (char *) 0;
symset[which_set].nocolor = 0;
symset[which_set].handling = H_UNK; symset[which_set].handling = H_UNK;
symset[which_set].desc = (char *) 0;
symset[which_set].nocolor = 0; symset[which_set].nocolor = 0;
/* initialize restriction bits */ /* initialize restriction bits */
symset[which_set].primary = 0; symset[which_set].primary = 0;
+12 -1
View File
@@ -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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -4933,6 +4933,17 @@ int which_set;
return 1; 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 */ /* Parse the value of a SYMBOLS line from a config file */
void void
parsesymbols(opts) parsesymbols(opts)
+2 -1
View File
@@ -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. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1396,6 +1396,7 @@ freedynamicdata()
/* miscellaneous */ /* miscellaneous */
free_pickinv_cache(); free_pickinv_cache();
free_symsets();
#endif /* FREE_ALL_MEMORY */ #endif /* FREE_ALL_MEMORY */
#ifdef STATUS_VIA_WINDOWPORT #ifdef STATUS_VIA_WINDOWPORT
status_finish(); status_finish();