• Oran Agra's avatar
    Fix zrealloc to behave similarly to je_realloc when size is 0 · 5def6500
    Oran Agra authored
    According to C11, the behavior of realloc with size 0 is now deprecated.
    it can either behave as free(ptr) and return NULL, or return a valid pointer.
    but in zmalloc it can lead to zmalloc_oom_handler and panic.
    and that can affect modules that use it.
    
    It looks like both glibc allocator and jemalloc behave like so:
      realloc(malloc(32),0) returns NULL
      realloc(NULL,0) returns a valid pointer
    
    This commit changes zmalloc to behave the same
    5def6500
zmalloc.c 12.4 KB