X-Git-Url: https://ncurses.scripts.mit.edu/?p=ncurses.git;a=blobdiff_plain;f=test%2Fdemo_menus.c;h=4d553e2ea73c98947085f4a5fe02a0bab6057ecd;hp=fc7c89358ac3e467ad9cf111d8990e44e09819ab;hb=6374752643292ccd9bf7ee66485efe9aed9e8e48;hpb=8f527f87c0b979d9c2598ef5c3394463af288468 diff --git a/test/demo_menus.c b/test/demo_menus.c index fc7c8935..4d553e2e 100644 --- a/test/demo_menus.c +++ b/test/demo_menus.c @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ /* - * $Id: demo_menus.c,v 1.27 2008/08/04 15:37:52 tom Exp $ + * $Id: demo_menus.c,v 1.28 2008/08/23 20:31:54 tom Exp $ * * Demonstrate a variety of functions from the menu library. * Thomas Dickey - 2005/4/9 @@ -107,6 +107,8 @@ static MENU *mpBanner; static MENU *mpFile; static MENU *mpSelect; +static bool loaded_file = FALSE; + #if !HAVE_STRDUP #define strdup my_strdup static char * @@ -274,7 +276,7 @@ menu_destroy(MENU * m) /* free the extra data allocated in build_select_menu() */ if ((count > 0) && (m == mpSelect)) { - if (blob) { + if (blob && loaded_file) { Trace(("freeing blob %p", blob)); free((char *) blob); } @@ -392,6 +394,7 @@ build_select_menu(MenuNo number, char *filename) } fclose(fp); } + loaded_file = TRUE; } } }