Fixed accidental double free by realloc.