- RtlReAllocateHeap shouldn't allocate memory if ptr == NULL.

svn path=/trunk/; revision=10725
This commit is contained in:
Filip Navara
2004-08-28 22:14:08 +00:00
parent 034e605634
commit b1f6932d44
3 changed files with 15 additions and 7 deletions
+2
View File
@@ -31,5 +31,7 @@ void* calloc(size_t _nmemb, size_t _size)
*/
void* realloc(void* _ptr, size_t _size)
{
if (!_ptr)
return(HeapAlloc(GetProcessHeap(),0,_size));
return(HeapReAlloc(GetProcessHeap(),0,_ptr,_size));
}
+12 -6
View File
@@ -1,4 +1,4 @@
/* $Id: console.c,v 1.78 2004/08/24 17:21:11 navaraf Exp $
/* $Id: console.c,v 1.79 2004/08/28 22:14:08 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries
@@ -2682,11 +2682,17 @@ AddConsoleCtrlHandler(PHANDLER_ROUTINE HandlerRoutine)
else
{
NrCtrlHandlers++;
CtrlHandlers =
RtlReAllocateHeap(RtlGetProcessHeap(),
HEAP_ZERO_MEMORY,
(PVOID)CtrlHandlers,
NrCtrlHandlers * sizeof(PHANDLER_ROUTINE));
if (CtrlHandlers == NULL)
{
CtrlHandlers = RtlAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY,
NrCtrlHandlers * sizeof(PHANDLER_ROUTINE));
}
else
{
CtrlHandlers = RtlReAllocateHeap(RtlGetProcessHeap(), HEAP_ZERO_MEMORY,
(PVOID)CtrlHandlers,
NrCtrlHandlers * sizeof(PHANDLER_ROUTINE));
}
if (CtrlHandlers == NULL)
{
NrCtrlHandlers = 0;
+1 -1
View File
@@ -1296,7 +1296,7 @@ LPVOID STDCALL RtlReAllocateHeap(
SUBHEAP *subheap;
if (!ptr)
return RtlAllocateHeap( heap, flags, size ); /* FIXME: correct? */
return FALSE;
if (!(heapPtr = HEAP_GetPtr( heap )))
return FALSE;