Fix memory leak in vector.