Opened 4 years ago

Last modified 4 years ago

#187 new defect

Exiting from catch Leaks Exception Memory

Reported by: pabuhr Owned by:
Priority: minor Component: cfa-cc
Version: 1.0 Keywords:

Description (last modified by ajbeach)

Exception is not cleaned up for exit from handler.

#include <exception.hfa>


int main( int argc, char * argv[] ) {
	try {
		throw (fred){};
	} catch( fred * ex ) {
		exit( -1 );
	} // try
@plg2[101]% a.out
CFA warning (UNIX pid:17447) : program terminating with 32(0x20) bytes of storage allocated but not freed.
Possible cause is unfreed storage allocated by the program or system/library routines called from the program.

Change History (1)

comment:1 Changed 4 years ago by ajbeach

Description: modified (diff)
Summary: exception leaks storageExiting from catch Leaks Exception Memory

I already use a destructor to free storage, well a cleanup attribute that calls __cfaehm_cleanup_terminate. I might have to do something with at_exit or something for this as I believe exit doesn't unwind the stack.

Note: See TracTickets for help on using tickets.