Commit in reactos/lib/user32/windows on MAIN
class.c+5-31.51 -> 1.52
menu.c+3-121.72 -> 1.73
+8-15
2 modified files
- Correct freeing of heap memory.

reactos/lib/user32/windows
class.c 1.51 -> 1.52
diff -u -r1.51 -r1.52
--- class.c	15 Aug 2004 21:36:29 -0000	1.51
+++ class.c	4 Dec 2004 22:08:29 -0000	1.52
@@ -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 @@
       REGISTERCLASS_ANSI,
       0);
 
-   RtlFreeUnicodeString(&MenuName);
-   RtlFreeUnicodeString(&ClassName);
+   if (!IS_ATOM(lpwcx->lpszMenuName))
+      RtlFreeUnicodeString(&MenuName);
+   if (!IS_ATOM(lpwcx->lpszClassName))
+      RtlFreeUnicodeString(&ClassName);
 
    return (ATOM)Atom;
 }

reactos/lib/user32/windows
menu.c 1.72 -> 1.73
diff -u -r1.72 -r1.73
--- menu.c	4 Dec 2004 19:53:55 -0000	1.72
+++ menu.c	4 Dec 2004 22:08:30 -0000	1.73
@@ -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 @@
 
     res = NtUserInsertMenuItem(hMenu, uItem, fByPosition, &mi);
 
-    if ( CleanHeap ) HEAP_free ( mi.dwTypeData );
+    if ( CleanHeap ) HEAP_free ( MenuText.Buffer );
   }
   return res;
 }
@@ -4094,8 +4094,6 @@
   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 @@
     {
       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;
 }
CVSspam 0.2.8