summary refs log tree commit diff
path: root/stdlib/exit.c
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/exit.c')
-rw-r--r--stdlib/exit.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/stdlib/exit.c b/stdlib/exit.c
index dc189556b4..f44c519aa7 100644
--- a/stdlib/exit.c
+++ b/stdlib/exit.c
@@ -62,7 +62,10 @@ exit (int status)
 
       old = __exit_funcs;
       __exit_funcs = __exit_funcs->next;
-      free (old);
+      if (__exit_funcs != NULL)
+	/* Don't free the last element in the chain, this is the statically
+	   allocate element.  */
+	free (old);
     }
 
 #ifdef	HAVE_GNU_LD