Don't leak memory when realloc fails