Mail Archives: djgpp-workers/1999/04/08/13:53:46
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
- Raw text -