Fix a memory leak, and remove an allocation.