curses status cleanup

Stop the last of the memory leaks occuring during basic usage.
This commit is contained in:
PatR
2019-02-09 15:30:53 -08:00
parent d4d7901eff
commit d80fd8a014
4 changed files with 7 additions and 8 deletions

View File

@@ -181,7 +181,7 @@ extern void curses_del_menu(winid wid);
/* cursstat.c */ /* cursstat.c */
extern void curses_status_init(void); extern void curses_status_init(void);
extern void curses_teardown_status(void); extern void curses_status_finish(void);
extern void curses_status_update(int, genericptr_t, int, int, int, extern void curses_status_update(int, genericptr_t, int, int, int,
unsigned long *); unsigned long *);

View File

@@ -75,7 +75,7 @@ struct window_procs curses_procs = {
genl_getmsghistory, genl_getmsghistory,
genl_putmsghistory, genl_putmsghistory,
curses_status_init, curses_status_init,
genl_status_finish, curses_status_finish,
genl_status_enablefield, genl_status_enablefield,
curses_status_update, curses_status_update,
genl_can_suspend_yes, genl_can_suspend_yes,

View File

@@ -58,15 +58,16 @@ curses_status_init()
} }
void void
curses_teardown_status() curses_status_finish()
{ {
#ifdef STATUS_HILITES #ifdef STATUS_HILITES
int i; int i;
for (i = 0; i < MAXBLSTATS; ++i) { for (i = 0; i < MAXBLSTATS; ++i) {
free(status_vals_long[i]); if (status_vals_long[i])
status_vals_long[i] = (char *) 0; free(status_vals_long[i]), status_vals_long[i] = (char *) 0;
} }
genl_status_finish();
#endif /* STATUS_HILITES */ #endif /* STATUS_HILITES */
return; return;
} }

View File

@@ -313,9 +313,7 @@ curses_del_nhwin(winid wid)
return; return;
} }
if (wid == MESSAGE_WIN) { if (wid == MESSAGE_WIN) {
curses_teardown_messages(); curses_teardown_messages();
} else if (wid == STATUS_WIN) {
curses_teardown_status();
} }
nhwins[wid].curwin = NULL; nhwins[wid].curwin = NULL;
nhwins[wid].nhwin = -1; nhwins[wid].nhwin = -1;