Fix leak in tests