(menu_list.c) menu_list_new - goto error

This commit is contained in:
twinaphex 2015-06-12 14:30:40 +02:00
parent f9ab351bf9
commit 1916e66780
1 changed files with 11 additions and 10 deletions

View File

@ -194,18 +194,19 @@ menu_list_t *menu_list_new(void)
list->selection_buf = (file_list_t*)calloc(1, sizeof(file_list_t));
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;
}
goto error;
return list;
error:
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;
}
size_t menu_list_get_stack_size(menu_list_t *list)