[uClibc-cvs] uClibc/libc/stdlib atexit.c,1.23,1.24

Manuel Novoa III mjn3 at uclibc.org
Sun Nov 2 08:29:14 UTC 2003


Update of /var/cvs/uClibc/libc/stdlib
In directory winder:/tmp/cvs-serv8769

Modified Files:
	atexit.c 
Log Message:
If realloc failed, we'd lose the pointer to the exit function table.


Index: atexit.c
===================================================================
RCS file: /var/cvs/uClibc/libc/stdlib/atexit.c,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -d -r1.23 -r1.24
--- atexit.c	24 Jan 2003 11:18:29 -0000	1.23
+++ atexit.c	2 Nov 2003 08:29:10 -0000	1.24
@@ -96,13 +96,14 @@
 #ifdef __UCLIBC_DYNAMIC_ATEXIT__
 	/* If we are out of function table slots, make some more */
 	if (__exit_slots < __exit_count+1) {
-	    __exit_function_table=realloc(__exit_function_table, 
-		    (__exit_slots+20)*sizeof(struct exit_function));
-	    if (__exit_function_table==NULL) {
+	    efp=realloc(__exit_function_table, 
+					(__exit_slots+20)*sizeof(struct exit_function));
+	    if (efp==NULL) {
 		UNLOCK;
 		__set_errno(ENOMEM);
 		return -1;
 	    }
+		__exit_function_table = efp;
 	    __exit_slots+=20;
 	}
 #else
@@ -138,13 +139,14 @@
 #ifdef __UCLIBC_DYNAMIC_ATEXIT__
 	/* If we are out of function table slots, make some more */
 	if (__exit_slots < __exit_count+1) {
-	    __exit_function_table=realloc(__exit_function_table, 
-		    (__exit_slots+20)*sizeof(struct exit_function));
-	    if (__exit_function_table==NULL) {
+	    efp=realloc(__exit_function_table, 
+					(__exit_slots+20)*sizeof(struct exit_function));
+	    if (efp==NULL) {
 		UNLOCK;
 		__set_errno(ENOMEM);
 		return -1;
 	    }
+		__exit_function_table=efp;
 	    __exit_slots+=20;
 	}
 #else




More information about the uClibc-cvs mailing list