Use ifdef HAVE_MALLOC_H to fix compile under MAC OS X

Signed-off-by: Jari Aalto <jari.aalto@cante.net>