From f9ab351bf90681936b31358837cbc11f750edbf8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 12 Jun 2015 14:29:21 +0200 Subject: [PATCH] (menu_list.c) menu_list_new - prevent some possible leaks --- menu/menu_list.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/menu/menu_list.c b/menu/menu_list.c index 8183cb2432..fd96424bae 100644 --- a/menu/menu_list.c +++ b/menu/menu_list.c @@ -176,6 +176,10 @@ void menu_list_free(menu_list_t *menu_list) menu_list_free_list(menu_list->menu_stack); menu_list_free_list(menu_list->selection_buf); + + menu_list->menu_stack = NULL; + menu_list->selection_buf = NULL; + free(menu_list); } @@ -191,6 +195,12 @@ menu_list_t *menu_list_new(void) if (!list->menu_stack || !list->selection_buf) { + if (list->menu_stack) + free(list->menu_stack); + list->menu_stack = NULL; + if (list->selection_buf) + free(list->selection_buf); + list->selection_buf = NULL; free(list); return NULL; }