diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-04-19 18:26:10 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-04-19 18:26:10 +0000 |
commit | 4e648ea3ad623fa7e6f2afcdf2cb0aefefdda061 (patch) | |
tree | 5d2a3274fca36375eb460f483d802db22c0fea5e /nptl/sysdeps/unix/sysv | |
parent | 2c008571c3ad156479307b7e23185ae566b5776a (diff) | |
download | glibc-4e648ea3ad623fa7e6f2afcdf2cb0aefefdda061.tar.gz glibc-4e648ea3ad623fa7e6f2afcdf2cb0aefefdda061.tar.xz glibc-4e648ea3ad623fa7e6f2afcdf2cb0aefefdda061.zip |
Update.
* stdlib/cxa_finalize.c (__cxa_finalize): Don't call UNREGISTER_ATFORK if d == NULL.
Diffstat (limited to 'nptl/sysdeps/unix/sysv')
-rw-r--r-- | nptl/sysdeps/unix/sysv/linux/unregister-atfork.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c b/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c index 7b3a785923..e9eb1918f6 100644 --- a/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c +++ b/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c @@ -22,6 +22,14 @@ #include "fork.h" +/* Defined in libc_pthread_init.c. */ +extern struct fork_handler __pthread_child_handler attribute_hidden; +/* Three static memory blocks used when registering malloc. */ +static struct fork_handler malloc_prepare; +static struct fork_handler malloc_parent; +static struct fork_handler malloc_child; + + void __unregister_atfork (dso_handle) void *dso_handle; @@ -37,7 +45,9 @@ __unregister_atfork (dso_handle) { list_del (runp); - free (list_entry (runp, struct fork_handler, list)); + struct fork_handler *p = list_entry (runp, struct fork_handler, list); + if (p != &malloc_prepare) + free (p); } list_for_each_prev_safe (runp, prevp, &__fork_parent_list) @@ -45,7 +55,9 @@ __unregister_atfork (dso_handle) { list_del (runp); - free (list_entry (runp, struct fork_handler, list)); + struct fork_handler *p = list_entry (runp, struct fork_handler, list); + if (p != &malloc_parent) + free (p); } list_for_each_prev_safe (runp, prevp, &__fork_child_list) @@ -53,7 +65,9 @@ __unregister_atfork (dso_handle) { list_del (runp); - free (list_entry (runp, struct fork_handler, list)); + struct fork_handler *p = list_entry (runp, struct fork_handler, list); + if (p != &__pthread_child_handler && p != &malloc_child) + free (p); } /* Release the lock. */ |