Fix a memory leak of a thrown object.