From bddb3b08c53ed8d45de14f84c899863792a68081 Mon Sep 17 00:00:00 2001 From: Dylan Whichard Date: Thu, 26 Oct 2023 12:13:14 -0700 Subject: [PATCH] Fix use-after free in removeSingleItemFromMenu() --- main/menu/menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/menu/menu.c b/main/menu/menu.c index 01989d32c..56c19a20d 100644 --- a/main/menu/menu.c +++ b/main/menu/menu.c @@ -219,7 +219,6 @@ void removeSingleItemFromMenu(menu_t* menu, const char* label) menuItem_t* item = listNode->val; if (item->label == label) { - removeEntry(menu->items, listNode); if (menu->currentItem == listNode) { if (NULL != listNode->next) @@ -231,6 +230,7 @@ void removeSingleItemFromMenu(menu_t* menu, const char* label) menu->currentItem = listNode->prev; } } + removeEntry(menu->items, listNode); free(item); return; }