Patch from Robert O'Callahan:

make realloc(NULL, size) behave like malloc(size), and make
  realloc(ptr, 0) behave like free(ptr), as the real libc realloc does.



git-svn-id: svn://svn.valgrind.org/valgrind/trunk@8666
This commit is contained in:
Nicholas Nethercote 2008-10-12 19:51:41 +00:00
parent ea36ea5a4e
commit d33b3e0d24

View File

@ -1770,6 +1770,15 @@ void* VG_(arena_realloc) ( ArenaId aid, HChar* cc,
vg_assert(req_pszB < MAX_PSZB);
if (NULL == ptr) {
return VG_(arena_malloc)(aid, cc, req_pszB);
}
if (req_pszB == 0) {
VG_(arena_free)(aid, ptr);
return NULL;
}
b = get_payload_block(a, ptr);
vg_assert(blockSane(a, b));