curses memory: 'anything identifier'

Three or four instances of one simple memory leak.  Allocating a union
'anything' to pass to add_menu(), then not doing anything with it.  The
value gets copied so there's no reason for the original to stick around.

[There are still lots of other memory leaks.]
This commit is contained in:
PatR
2019-02-07 17:10:55 -08:00
parent 19d737951e
commit 1d5b59ab7e
3 changed files with 10 additions and 16 deletions
+4 -7
View File
@@ -281,23 +281,20 @@ curses_prev_mesg()
int count;
winid wid;
long turn = 0;
anything *identifier;
anything Id;
nhprev_mesg *mesg;
menu_item *selected = NULL;
wid = curses_get_wid(NHW_MENU);
curses_create_nhmenu(wid);
identifier = (anything *) alloc((unsigned) sizeof (anything));
identifier->a_void = NULL;
Id = zeroany;
for (count = 0; count < num_messages; count++) {
mesg = get_msg_line(TRUE, count);
if ((turn != mesg->turn) && (count != 0)) {
curses_add_menu(wid, NO_GLYPH, identifier, 0, 0, A_NORMAL,
"---", FALSE);
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, "---", FALSE);
}
curses_add_menu(wid, NO_GLYPH, identifier, 0, 0, A_NORMAL,
mesg->str, FALSE);
curses_add_menu(wid, NO_GLYPH, &Id, 0, 0, A_NORMAL, mesg->str, FALSE);
turn = mesg->turn;
}