Thread-safe xmalloc and xrealloc needs a recursive mutex