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

Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
fix(memory): realloc must behave like malloc when ptr is nullptr