Index: libcfa/src/exception.c
===================================================================
--- libcfa/src/exception.c	(revision 046a8903d149ffd7aa25c33fdf767b8e68ffaaca)
+++ libcfa/src/exception.c	(revision 8ad57526fac65680cee486a070c56fdcbee2a28e)
@@ -10,6 +10,6 @@
 // Created On       : Mon Jun 26 15:13:00 2017
 // Last Modified By : Andrew Beach
-// Last Modified On : Tue May 19 14:17:00 2020
-// Update Count     : 19
+// Last Modified On : Thr May 21 12:18:00 2020
+// Update Count     : 20
 //
 
@@ -237,7 +237,14 @@
 }
 
+static void __cfaehm_cleanup_default( exception_t ** except ) {
+	__cfaehm_delete_exception( *except );
+	*except = NULL;
+}
+
 // The exception that is being thrown must already be stored.
 static void __cfaehm_begin_unwind(void(*defaultHandler)(exception_t *)) {
-	if ( ! this_exception_context()->current_exception ) {
+	struct exception_context_t * context = this_exception_context();
+	struct _Unwind_Exception * storage = &this_exception_storage;
+	if ( NULL == context->current_exception ) {
 		printf("UNWIND ERROR missing exception in begin unwind\n");
 		abort();
@@ -245,5 +252,6 @@
 
 	// Call stdlibc to raise the exception
-	_Unwind_Reason_Code ret = _Unwind_RaiseException( &this_exception_storage );
+	__cfadbg_print_safe(exception, "Begin unwinding (storage &p, context %p)\n", storage, context);
+	_Unwind_Reason_Code ret = _Unwind_RaiseException( storage );
 
 	// If we reach here it means something happened. For resumption to work we need to find a way
@@ -254,14 +262,16 @@
 	// the whole stack.
 
+	// We did not simply reach the end of the stack without finding a handler. This is an error.
+	if ( ret != _URC_END_OF_STACK ) {
+		printf("UNWIND ERROR %d after raise exception\n", ret);
+		abort();
+	}
+
 	// No handler found, go to the default operation.
-	if ( ret == _URC_END_OF_STACK ) {
-		__cfadbg_print_safe(exception, "Uncaught exception %p\n", &this_exception_storage);
-
-		defaultHandler( this_exception_context()->current_exception );
-	}
-
-	// We did not simply reach the end of the stack without finding a handler. This is an error.
-	printf("UNWIND ERROR %d after raise exception\n", ret);
-	abort();
+	__cfadbg_print_safe(exception, "Uncaught exception %p\n", storage);
+
+	__attribute__((cleanup(__cfaehm_cleanup_default)))
+	exception_t * exception = context->current_exception;
+	defaultHandler( exception );
 }
 
