mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-08-29 19:26:33 +00:00
- Correct freeing of heap memory.
svn path=/trunk/; revision=11929
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $Id: class.c,v 1.51 2004/08/15 21:36:29 chorns Exp $
|
||||
/* $Id: class.c,v 1.52 2004/12/04 22:08:29 navaraf Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS user32.dll
|
||||
@@ -464,8 +464,10 @@ RegisterClassExA(CONST WNDCLASSEXA *lpwcx)
|
||||
REGISTERCLASS_ANSI,
|
||||
0);
|
||||
|
||||
RtlFreeUnicodeString(&MenuName);
|
||||
RtlFreeUnicodeString(&ClassName);
|
||||
if (!IS_ATOM(lpwcx->lpszMenuName))
|
||||
RtlFreeUnicodeString(&MenuName);
|
||||
if (!IS_ATOM(lpwcx->lpszClassName))
|
||||
RtlFreeUnicodeString(&ClassName);
|
||||
|
||||
return (ATOM)Atom;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
/* $Id: menu.c,v 1.72 2004/12/04 19:53:55 navaraf Exp $
|
||||
/* $Id: menu.c,v 1.73 2004/12/04 22:08:30 navaraf Exp $
|
||||
*
|
||||
* PROJECT: ReactOS user32.dll
|
||||
* FILE: lib/user32/windows/menu.c
|
||||
@@ -4074,7 +4074,7 @@ InsertMenuItemA(
|
||||
|
||||
res = NtUserInsertMenuItem(hMenu, uItem, fByPosition, &mi);
|
||||
|
||||
if ( CleanHeap ) HEAP_free ( mi.dwTypeData );
|
||||
if ( CleanHeap ) HEAP_free ( MenuText.Buffer );
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@@ -4094,8 +4094,6 @@ InsertMenuItemW(
|
||||
MENUITEMINFOW mi;
|
||||
UNICODE_STRING MenuText;
|
||||
BOOL res = FALSE;
|
||||
BOOL CleanHeap = FALSE;
|
||||
HANDLE hHeap = GetProcessHeap();
|
||||
mi.hbmpItem = (HBITMAP)0;
|
||||
|
||||
// while we could just pass 'lpmii' to win32k, we make a copy so that
|
||||
@@ -4113,20 +4111,13 @@ InsertMenuItemW(
|
||||
{
|
||||
if(lpmii->cch > 0)
|
||||
{
|
||||
if(!RtlCreateUnicodeString(&MenuText, (PWSTR)lpmii->dwTypeData))
|
||||
{
|
||||
SetLastError (RtlNtStatusToDosError(STATUS_NO_MEMORY));
|
||||
return FALSE;
|
||||
}
|
||||
RtlInitUnicodeString(&MenuText, (PWSTR)lpmii->dwTypeData);
|
||||
mi.dwTypeData = (LPWSTR)&MenuText;
|
||||
mi.cch = MenuText.Length / sizeof(WCHAR);
|
||||
CleanHeap = TRUE;
|
||||
}
|
||||
};
|
||||
|
||||
res = NtUserInsertMenuItem(hMenu, uItem, fByPosition, &mi);
|
||||
|
||||
if(CleanHeap) RtlFreeHeap (hHeap, 0, mi.dwTypeData);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user