The array size is being decreased so failure is not critical here, but it can still happen, e.g. when DPH is in use.
Signed-off-by: Thomas Faber thomas.faber@reactos.org --- dlls/user32/menu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index 38deaef33d71..f4194ed6f2a2 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -3989,14 +3989,16 @@ BOOL WINAPI RemoveMenu( HMENU hMenu, UINT nPos, UINT wFlags ) } else { + MENUITEM *new_items; while(nPos < menu->nItems) { *item = *(item+1); item++; nPos++; } - menu->items = HeapReAlloc( GetProcessHeap(), 0, menu->items, - menu->nItems * sizeof(MENUITEM) ); + new_items = HeapReAlloc( GetProcessHeap(), 0, menu->items, + menu->nItems * sizeof(MENUITEM) ); + if (new_items) menu->items = new_items; } return TRUE; }