Fix memory leak test