[PATCH] Add missing lock releases in __register_exitproc().
Corinna Vinschen
vinschen@redhat.com
Mon Dec 14 13:42:00 GMT 2015
On Dec 12 15:10, Freddie Chopin wrote:
> >From 226aeb4f502fc9404567062f68d527ef012ea683 Sat, 12 Dec 2015 15:07:48 +0100
> From: Freddie Chopin <freddie.chopin@gmail.com>
> Date: Sat, 12 Dec 2015 11:52:21 +0100
> Subject: [PATCH] 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.
>
> diff --git a/newlib/libc/stdlib/__atexit.c b/newlib/libc/stdlib/__atexit.c
> index 18edc8c..a3d5bdf 100644
> --- a/newlib/libc/stdlib/__atexit.c
> +++ b/newlib/libc/stdlib/__atexit.c
> @@ -83,12 +83,20 @@
> 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)
Applied.
Thanks,
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20151214/6e1f1113/attachment.sig>
More information about the Newlib
mailing list