Skip to content

Commit

Permalink
[NTUSER] MENU_HideSubPopups: Check ValidateHwndNoErr return value
Browse files Browse the repository at this point in the history
Check if the return value is not NULL before calling co_UserDestroyWindow.
CORE-19367
  • Loading branch information
TAN-Gaming committed Dec 9, 2023
1 parent e4d03f4 commit 0d1b3f3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions win32ss/user/ntuser/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -3282,11 +3282,13 @@ static void FASTCALL MENU_HideSubPopups(PWND pWndOwner, PMENU Menu,
{
PWND pWnd;
if (!VerifyMenu(Item->spSubMenu)) return;
pWnd = ValidateHwndNoErr(Item->spSubMenu->hWnd);
MENU_HideSubPopups(pWndOwner, Item->spSubMenu, FALSE, wFlags);
MENU_SelectItem(pWndOwner, Item->spSubMenu, NO_SELECTED_ITEM, SendMenuSelect, NULL);
TRACE("M_HSP top p hm %p pWndOwner IDMenu %p\n",top_popup_hmenu,pWndOwner->IDMenu);
co_UserDestroyWindow(pWnd);

pWnd = ValidateHwndNoErr(Item->spSubMenu->hWnd);
if (pWnd)
co_UserDestroyWindow(pWnd);

/* Native returns handle to destroyed window */
if (!(wFlags & TPM_NONOTIFY))
Expand Down

0 comments on commit 0d1b3f3

Please sign in to comment.