fix(memory): realloc must behave like malloc when ptr is nullptr

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
Leonardo de Moura 2013-11-08 10:31:57 -08:00
parent a10aa0880f
commit c5207489fd

View file

@ -137,6 +137,8 @@ void * malloc(size_t sz) {
}
void * realloc(void * ptr, size_t sz) {
if (ptr == nullptr)
return malloc(sz);
size_t old_sz = malloc_size(ptr);
g_global_memory.dec(old_sz);
g_thread_memory.dec(old_sz);