Message-Id: Comments: Authenticated sender is From: "Salvador Eduardo Tropea (SET)" Organization: INTI To: djgpp-workers AT delorie DOT com Date: Thu, 8 Apr 1999 14:56:57 +0000 MIME-Version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Subject: Proposed patch to exit() X-mailer: Pegasus Mail for Windows (v2.54) Reply-To: djgpp-workers AT delorie DOT com Hi All: The following patch is cosmetic but I think is good. It just calls free in exit to de-allocate all the memory allocated by the atexit() function. I know that's not necesary because we will release all when leaving the control to the OS but it helps to track memory leaks. My editor is registering 23 functions with atexit and they are reported all the time by YAMD. Of course I can remove these entries from the report using a script but I think that's the best. SET --- src/libc/ansi/stdlib/exit.c~ Wed Apr 7 20:30:34 1999 +++ src/libc/ansi/stdlib/exit.c Wed Apr 7 20:30:34 1999 @@ -25,14 +25,16 @@ exit(int status) { int i; - struct __atexit *a; + struct __atexit *a,*o; a = __atexit_ptr; __atexit_ptr = 0; /* to prevent infinite loops */ while (a) { (a->__function)(); + o = a; a = a->__next; + free(o); } /* Destructors should probably be called after functions registered ------------------------------------ 0 -------------------------------- Visit my home page: http://welcome.to/SetSoft or http://www.geocities.com/SiliconValley/Vista/6552/ Salvador Eduardo Tropea (SET). (Electronics Engineer) Alternative e-mail: set-soft AT usa DOT net set AT computer DOT org ICQ: 2951574 Address: Curapaligue 2124, Caseros, 3 de Febrero Buenos Aires, (1678), ARGENTINA TE: +(5411) 4759 0013