mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-03 04:13:31 +00:00
- RtlReAllocateHeap shouldn't allocate memory if ptr == NULL.
svn path=/trunk/; revision=10725
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user