Skip to content

Commit db3fc8e

Browse files
committed
'tui.c' failed to free all memory on cleanup(). Yes, it all gets freed upon exiting, but freeing it 'properly' makes Valgrind usage simpler (you don't have a bunch of spurious unfreed buffers to look at).
1 parent cdb93d6 commit db3fc8e

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

demos/tui.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ static int nexty, nextx;
5959
static int key = ERR, ch = ERR;
6060
static bool quit = FALSE;
6161
static bool incurses = FALSE;
62+
static SCREEN *screen_pointer;
6263

6364
#ifndef PDCURSES
6465
static char wordchar(void)
@@ -348,6 +349,7 @@ static void cleanup(void) /* cleanup curses settings */
348349
delwin(wstat);
349350
curs_set(1);
350351
endwin();
352+
delscreen( screen_pointer);
351353
incurses = FALSE;
352354
}
353355
}
@@ -531,7 +533,7 @@ void domenu(menu *mp)
531533

532534
void startmenu(menu *mp, char *mtitle)
533535
{
534-
initscr();
536+
screen_pointer = newterm(NULL, stdout, stdin);
535537
incurses = TRUE;
536538
initcolor();
537539

0 commit comments

Comments
 (0)