Fixing a possible memory leak from a failing realloc() call.