mempool: Fix realloc() debug version

Fix the following issues with the debug version of realloc():

  - Make realloc with NULL ptr behave like malloc()

  - Make realloc with non-NULL pointer and zero size behave like free()

  - Avoid malloc() if we have enough space in original memory block

  - Return NULL if the new allocation fails but don't deallocate the
    original memory block

Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>