[ros-diffs] [gschneider] 44306: [msvcrt] - Use the process heap for malloc and friends - Fixes a crash during GIMP startup (bug #3503, part 1)

gschneider at svn.reactos.org gschneider at svn.reactos.org
Sat Nov 28 16:13:18 CET 2009


Author: gschneider
Date: Sat Nov 28 16:13:18 2009
New Revision: 44306

URL: http://svn.reactos.org/svn/reactos?rev=44306&view=rev
Log:
[msvcrt]
- Use the process heap for malloc and friends
- Fixes a crash during GIMP startup (bug #3503, part 1)

Modified:
    trunk/reactos/lib/sdk/crt/stdlib/malloc.c

Modified: trunk/reactos/lib/sdk/crt/stdlib/malloc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/stdlib/malloc.c?rev=44306&r1=44305&r2=44306&view=diff
==============================================================================
--- trunk/reactos/lib/sdk/crt/stdlib/malloc.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/stdlib/malloc.c [iso-8859-1] Sat Nov 28 16:13:18 2009
@@ -34,8 +34,6 @@
 /* round to 16 bytes + alloc at minimum 16 bytes */
 #define ROUND_SIZE(size) (max(16, ROUND_UP(size, 16)))
 
-extern HANDLE hHeap;
-
 /*
  * @implemented
  */
@@ -46,7 +44,7 @@
    if (nSize<_size)
        return NULL;
 
-   return HeapAlloc(hHeap, 0, nSize);
+   return HeapAlloc(GetProcessHeap(), 0, nSize);
 }
 
 /*
@@ -54,7 +52,7 @@
  */
 void free(void* _ptr)
 {
-   HeapFree(hHeap,0,_ptr);
+   HeapFree(GetProcessHeap(),0,_ptr);
 }
 
 /*
@@ -68,7 +66,7 @@
    if ( (_nmemb > ((size_t)-1 / _size))  || (cSize<nSize))
       return NULL;
 
-   return HeapAlloc(hHeap, HEAP_ZERO_MEMORY, cSize );
+   return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, cSize );
 }
 
 /*
@@ -93,7 +91,7 @@
    if (nSize<_size)
        return NULL;
 
-   return HeapReAlloc(hHeap, 0, _ptr, nSize);
+   return HeapReAlloc(GetProcessHeap(), 0, _ptr, nSize);
 }
 
 /*
@@ -108,7 +106,7 @@
    if (nSize<_size)
        return NULL;
 
-   return HeapReAlloc(hHeap, HEAP_REALLOC_IN_PLACE_ONLY, _ptr, nSize);
+   return HeapReAlloc(GetProcessHeap(), HEAP_REALLOC_IN_PLACE_ONLY, _ptr, nSize);
 }
 
 /*
@@ -116,7 +114,7 @@
  */
 size_t _msize(void* _ptr)
 {
-   return HeapSize(hHeap, 0, _ptr);
+   return HeapSize(GetProcessHeap(), 0, _ptr);
 }
 
 /*
@@ -124,7 +122,7 @@
  */
 int	_heapchk(void)
 {
-	if (!HeapValidate(hHeap, 0, NULL))
+	if (!HeapValidate(GetProcessHeap(), 0, NULL))
 		return -1;
 	return 0;
 }
@@ -134,7 +132,7 @@
  */
 int	_heapmin(void)
 {
-	if (!HeapCompact(hHeap, 0))
+	if (!HeapCompact(GetProcessHeap(), 0))
 		return -1;
 	return 0;
 }




More information about the Ros-diffs mailing list