release some memory before exit under Windows

This commit is contained in:
nhmall
2024-11-11 16:50:57 -05:00
parent fd0b67de4d
commit 7414b906b2
4 changed files with 35 additions and 17 deletions

View File

@@ -1128,8 +1128,6 @@ consoletty_open(int mode)
void
consoletty_exit(void)
{
/* frees some status tracking data */
genl_status_finish();
/* go back to using the safe routines */
safe_routines();
free_custom_colors();

View File

@@ -499,8 +499,9 @@ extern const char *known_restrictions[]; /* symbols.c */
DISABLE_WARNING_UNREACHABLE_CODE
#if defined(__MINGW32__) && defined(MSWIN_GRAPHICS)
#define MAIN mingw_main
#if defined(MSWIN_GRAPHICS)
#define MAIN nethackw_main
#else
#define MAIN main
#endif

View File

@@ -483,6 +483,10 @@ get_port_id(char *buf)
}
#endif /* RUNTIME_PORT_ID */
#ifdef MSWIN_GRAPHICS
extern void free_winmain_stuff(void);
#endif
void
nethack_exit(int code)
{
@@ -506,6 +510,11 @@ nethack_exit(int code)
if (iflags.window_inited)
wait_synch();
}
/* frees some status tracking data */
genl_status_finish();
#ifdef MSWIN_GRAPHICS
free_winmain_stuff();
#endif
exit(code);
}