[WIN32K:NTUSER] Handle IntCloneMenu failure in MENU_GetSystemMenu. CORE-12180
authorThomas Faber <thomas.faber@reactos.org>
Sat, 3 Mar 2018 07:19:13 +0000 (08:19 +0100)
committerThomas Faber <thomas.faber@reactos.org>
Sat, 3 Mar 2018 16:18:55 +0000 (17:18 +0100)
win32ss/user/ntuser/menu.c

index 888b4ea..dc6656f 100644 (file)
@@ -5120,6 +5120,12 @@ PMENU FASTCALL MENU_GetSystemMenu(PWND Window, PMENU Popup)
       IntMenuItemInfo(Menu, SC_MINIMIZE, FALSE, &ItemInfoSet, TRUE, NULL);
 
       NewMenu = IntCloneMenu(Menu);
+      if (NewMenu == NULL)
+      {
+         IntDestroyMenuObject(Menu, FALSE);
+         IntDestroyMenuObject(SysMenu, FALSE);
+         return NULL;
+      }
 
       IntReleaseMenuObject(NewMenu);
       UserSetMenuDefaultItem(NewMenu, SC_CLOSE, FALSE);