From: Ulrich Drepper Date: Mon, 11 Oct 1999 04:35:54 +0000 (+0000) Subject: (exit): Beware to not free statically allocated list element. X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b4f968052192101f62bbbac3c1cc14692fe8628a;p=thirdparty%2Fglibc.git (exit): Beware to not free statically allocated list element. --- diff --git a/stdlib/exit.c b/stdlib/exit.c index dc189556b49..f44c519aa75 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