]> git.ipfire.org Git - thirdparty/glibc.git/commit
dlfcn: Guard __dlerror_main_freeres with __libc_once_get (once) [BZ#24476]
authorMark Wielaard <mark@klomp.org>
Wed, 15 May 2019 15:14:01 +0000 (17:14 +0200)
committerMark Wielaard <mark@klomp.org>
Thu, 16 May 2019 13:19:44 +0000 (15:19 +0200)
commit059d6750f923b2c3aa06c82befa430142ef10389
treeb3cb80daf2e08e42ae85c686f5bc56867c4e4571
parentd948478bc586dec2fe3edd49e8e55f3893b3f854
dlfcn: Guard __dlerror_main_freeres with __libc_once_get (once) [BZ#24476]

dlerror.c (__dlerror_main_freeres) will try to free resources which only
have been initialized when init () has been called. That function is
called when resources are needed using __libc_once (once, init) where
once is a __libc_once_define (static, once) in the dlerror.c file.
Trying to free those resources if init () hasn't been called will
produce errors under valgrind memcheck. So guard the freeing of those
resources using __libc_once_get (once) and make sure we have a valid
key. Also add a similar guard to __dlerror ().

* dlfcn/dlerror.c (__dlerror_main_freeres): Guard using
__libc_once_get (once) and static_bug == NULL.
(__dlerror): Check we have a valid key, set result to static_buf
otherwise.

Reviewed-by: Carlos O'Donell <carlos@redhat.com>
(cherry picked from commit 11b451c8868d8a2b0edc5dfd44fc58d9ee538be0)
ChangeLog
NEWS
dlfcn/dlerror.c