xmalloc: added optional debugging code to check validity of thread chunks.
Added ALLOW_UNINIT_VALUES symbol to avoid using uninitialized bytes.

The uninitialized bytes are normally used to collect additional entropy from
the system, mostly to initialize the random seeds for pseudo-random number
generation.

Although this is perfectly safe (yes, the result is undefined, but that is the
point), it creates a cascade of errors when running under "valgrind" because
the random seeds are all tainted by the use of these undefined values, and
many operations in gtk-gnutella depend on them (e.g. the initial random hash
offsetting).

Therefore, when running under "valgrind", undefine the ALLOW_UNINIT_VALUES
symbol in common.h, to prevent these "errors" from being reported.
SHA1_reset(): added explicit ZERO() instead of manually settings fields to 0.

In case the SHA1 structure is changed one day, this makes sure we're not
leaving parts of it un-initialized by mistake.
getgateway(): properly fallback to netstat parsing when socket() fails.
xmalloc_addcore_from_heap(): ensure we always catch sbrk() errors.
Added extra zero-ing to shut down spurious "valgrind" unitialized access errors.