mirror of
https://github.com/Zenithsiz/ftmemsim-valgrind.git
synced 2026-02-04 02:18:37 +00:00
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:
parent
ea36ea5a4e
commit
d33b3e0d24
@ -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));
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user