debugging malloc: fix realloc()

In about 10% of the boots with the debugging allocator enabled
(conf-debug_memory=1), we fail on setenv() which frees some memory
and thinks it sees an overflow. But this is not a real setenv() bug,
but just a false alarm - a bug in the debugging allocator. This patch
fixes this bug:

When debugging malloc is enabled (conf-debug_memory=1), most malloc()
calls are done with dbg::malloc(), but some allocations are still
performed by the standard allocator. This includes some very early
allocations (before the debugging allocator is enabled) and nested
allocations from within the debugging allocator. For this reason,
free() checks every address if it is in the debugging-allocator range
or the standard allocator range.

realloc() needs to do the same, of course, for the old pointer passed
to it. But realloc() called dbg::realloc() which then called "free()".
This unqualified "free()" ends up calling dbg::free() always, even
for addresses not allocated by the debugging allocator. It needs to
call ::free(), not free(), to ensure that each address is checked
separately on how to free it.

The bug was seen with setenv() because setenv() uses realloc() to
allocate the environment variable buffer, and because loader.cc
sets one environment variable *before* enabling the debugging allocator,
so it is originally allocated with the standard allocator - and later
realloc()ed with the debugging allocator enabled.

Fixes #549.

Signed-off-by: Nadav Har'El <nyh@cloudius-systems.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>