This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Bug in __register_exitproc() in __atexit.c


On Dec  8 16:40, Freddie Chopin wrote:
> Hello!
> 
> Today I noticed that even when I disable dynamic allocation of memory in 
> atexit (with --disable-newlib-atexit-dynamic-alloc switch) malloc() is used in 
> __register_exitproc().
> 
> First of all, if this switch is used, then _ATEXIT_DYNAMIC_ALLOC is not 
> defined, so the first use of malloc() in this function - at line 93 - is 
> indeed disabled. But if small reent is used, malloc() is used again at line 
> 120 - this time it's not conditional on _ATEXIT_DYNAMIC_ALLOC being defined.
> 
> Moreover, at first glance it seems that there's a bug in this function. The 
> __atexit_lock lock is acquired at entry, but there are at two places where it 
> is not released before return - at line 86 and at line 91.
> 
> Should I try to provide a patch for both issues?

That would be nice :)


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat

Attachment: pgppmBRoc2OLs.pgp
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]