aboutsummaryrefslogtreecommitdiff
path: root/malloc/mtrace.c
diff options
context:
space:
mode:
Diffstat (limited to 'malloc/mtrace.c')
-rw-r--r--malloc/mtrace.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index 9ebbaeb..fddf137 100644
--- a/malloc/mtrace.c
+++ b/malloc/mtrace.c
@@ -291,8 +291,10 @@ mtrace ()
#ifdef _LIBC
if (!added_atexit_handler)
{
+ extern void *__dso_handle __attribute__ ((__weak__));
added_atexit_handler = 1;
- atexit (release_libc_mem);
+ __cxa_atexit ((void (*) (void *)) release_libc_mem, NULL,
+ &__dso_handle ? __dso_handle : NULL);
}
#endif
}