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:
parent
a10aa0880f
commit
c5207489fd
1 changed files with 2 additions and 0 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue