Fixed test memory leak