diff options
author | Freddie Chopin <freddie.chopin@gmail.com> | 2015-12-12 11:52:21 +0100 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2015-12-14 14:31:36 +0100 |
commit | c39ad27d9e76636527c37d030d7f7d651744a8f3 (patch) | |
tree | cad6fbf3091b5f1f3e8c3c37c27655a8c9e1b4ec | |
parent | ecfba2bb2ce95adda475c54800200dfb0acb35e9 (diff) | |
download | cygnal-c39ad27d9e76636527c37d030d7f7d651744a8f3.tar.gz cygnal-c39ad27d9e76636527c37d030d7f7d651744a8f3.tar.bz2 cygnal-c39ad27d9e76636527c37d030d7f7d651744a8f3.zip |
Add missing lock releases in __register_exitproc().
In some code paths the __atexit_lock held by this function was not
released when returning with an error.
* libc/stdlib/__atexit.c (__register_exitproc): Always release
lock before return.
-rw-r--r-- | newlib/ChangeLog | 5 | ||||
-rw-r--r-- | newlib/libc/stdlib/__atexit.c | 10 |
2 files changed, 14 insertions, 1 deletions
diff --git a/newlib/ChangeLog b/newlib/ChangeLog index 1524b9923..85e869363 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2015-12-12 Freddie Chopin <freddie.chopin@gmail.com> + + * libc/stdlib/__atexit.c (__register_exitproc): Always release + lock before return. + 2015-12-09 Thomas Preud'homme <thomas.preudhomme@arm.com> * libm/machine/arm/s_ceil.c: Also check that 64bit FP instructions are diff --git a/newlib/libc/stdlib/__atexit.c b/newlib/libc/stdlib/__atexit.c index 18edc8c91..a3d5bdfbf 100644 --- a/newlib/libc/stdlib/__atexit.c +++ b/newlib/libc/stdlib/__atexit.c @@ -83,12 +83,20 @@ _DEFUN (__register_exitproc, if (p->_ind >= _ATEXIT_SIZE) { #ifndef _ATEXIT_DYNAMIC_ALLOC +#ifndef __SINGLE_THREAD__ + __lock_release_recursive(__atexit_lock); +#endif return -1; #else /* Don't dynamically allocate the atexit array if malloc is not available. */ if (!malloc) - return -1; + { +#ifndef __SINGLE_THREAD__ + __lock_release_recursive(__atexit_lock); +#endif + return -1; + } p = (struct _atexit *) malloc (sizeof *p); if (p == NULL) |