Fix malloc_hook segfault on startup on some systems