mirror of
https://github.com/reactos/wine.git
synced 2024-11-26 13:10:28 +00:00
RtlHeapReAllocate() should not allocate memory.
Add small test to make sure it doesn't return. Don't import ntdll for tests, we need to load it dynamically.
This commit is contained in:
parent
e3c9de666d
commit
c762f5d7af
@ -10,6 +10,7 @@ environ.ok
|
||||
file.ok
|
||||
format_msg.ok
|
||||
generated.ok
|
||||
heap.ok
|
||||
kernel32_test.exe.spec.c
|
||||
locale.ok
|
||||
mailslot.ok
|
||||
|
@ -17,6 +17,7 @@ CTESTS = \
|
||||
file.c \
|
||||
format_msg.c \
|
||||
generated.c \
|
||||
heap.c \
|
||||
locale.c \
|
||||
mailslot.c \
|
||||
path.c \
|
||||
|
44
dlls/kernel/tests/heap.c
Normal file
44
dlls/kernel/tests/heap.c
Normal file
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Unit test suite for heap functions
|
||||
*
|
||||
* Copyright 2003 Dimitrie O. Paun
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "ntstatus.h"
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "wine/test.h"
|
||||
#include "winnt.h"
|
||||
#include "winnls.h"
|
||||
#include "winreg.h"
|
||||
#include "winternl.h"
|
||||
|
||||
static void test_realloc( void )
|
||||
{
|
||||
void *mem = NULL;
|
||||
|
||||
mem = HeapReAlloc(GetProcessHeap(), 0, mem, 10);
|
||||
ok(mem == NULL, "memory allocated");
|
||||
}
|
||||
|
||||
START_TEST(heap)
|
||||
{
|
||||
test_realloc();
|
||||
}
|
@ -1231,11 +1231,11 @@ PVOID WINAPI RtlReAllocateHeap( HANDLE heap, ULONG flags, PVOID ptr, ULONG size
|
||||
HEAP *heapPtr;
|
||||
SUBHEAP *subheap;
|
||||
|
||||
if (!ptr) return RtlAllocateHeap( heap, flags, size ); /* FIXME: correct? */
|
||||
if (!ptr) return NULL;
|
||||
if (!(heapPtr = HEAP_GetPtr( heap )))
|
||||
{
|
||||
set_status( STATUS_INVALID_HANDLE );
|
||||
return FALSE;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Validate the parameters */
|
||||
|
@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
|
||||
SRCDIR = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
TESTDLL = ntdll.dll
|
||||
IMPORTS = ntdll
|
||||
IMPORTS = kernel32
|
||||
|
||||
CTESTS = \
|
||||
env.c \
|
||||
|
Loading…
Reference in New Issue
Block a user