X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=liblttng-ust-libc-wrapper%2Flttng-ust-malloc.c;h=f3e1e19e28e52d8d5fe07d399f6c4741d0d87282;hb=f4a90c3e8f3f5e8dd5c1896afb82fa96c1a32f22;hp=5d290445026575f15de5074cb33f696be62c09c1;hpb=c62a3816777e0b9567498e9924acd2ca587da41a;p=lttng-ust.git diff --git a/liblttng-ust-libc-wrapper/lttng-ust-malloc.c b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c index 5d290445..f3e1e19e 100644 --- a/liblttng-ust-libc-wrapper/lttng-ust-malloc.c +++ b/liblttng-ust-libc-wrapper/lttng-ust-malloc.c @@ -421,6 +421,12 @@ int posix_memalign(void **memptr, size_t alignment, size_t size) return retval; } +static +void lttng_ust_fixup_malloc_nesting_tls(void) +{ + asm volatile ("" : : "m" (URCU_TLS(malloc_nesting))); +} + __attribute__((constructor)) void lttng_ust_malloc_wrapper_init(void) { @@ -428,6 +434,7 @@ void lttng_ust_malloc_wrapper_init(void) if (cur_alloc.calloc) { return; } + lttng_ust_fixup_malloc_nesting_tls(); /* * Ensure the allocator is in place before the process becomes * multithreaded.