Skip to content

Commit

Permalink
Fix use-after free in removeSingleItemFromMenu()
Browse files Browse the repository at this point in the history
  • Loading branch information
dylwhich committed Oct 28, 2023
1 parent c23e563 commit bddb3b0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion main/menu/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -231,6 +230,7 @@ void removeSingleItemFromMenu(menu_t* menu, const char* label)
menu->currentItem = listNode->prev;
}
}
removeEntry(menu->items, listNode);
free(item);
return;
}
Expand Down

0 comments on commit bddb3b0

Please sign in to comment.