1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-08-08 17:42:12 +03:00

malloc: Fix malloc init order

__ptmalloc_init was called too early in __libc_early_init: it uses
__libc_initial which is not set yet.  Fix this by moving initialization
to the end of __libc_early_init.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
This commit is contained in:
Wilco Dijkstra
2025-05-27 13:32:45 +00:00
parent a289cf711e
commit 919bf1489a

View File

@@ -33,9 +33,6 @@ _Bool __libc_initial;
void
__libc_early_init (_Bool initial)
{
/* Initialize system malloc. */
call_function_static_weak (__ptmalloc_init);
/* Initialize ctype data. */
__ctype_init ();
@@ -53,4 +50,7 @@ __libc_early_init (_Bool initial)
#if ENABLE_ELISION_SUPPORT
__lll_elision_init ();
#endif
/* Initialize system malloc (needs __libc_initial to be set). */
call_function_static_weak (__ptmalloc_init);
}