Verify memory and resources are freed in the event of an exception