Fix segfault when calling trealloc with a NULL buffer