summaryrefslogtreecommitdiff
path: root/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-02-13 07:14:38 +0000
committerUlrich Drepper <drepper@redhat.com>2003-02-13 07:14:38 +0000
commitdfdd294a2ac05a80908483846feb5343d4aac714 (patch)
treec6c2fdabffcf5e81cdf69dc2f78f8b437be6df5f /nptl/sysdeps/unix/sysv/linux/unregister-atfork.c
parent2067577c713671471ec03c52425625d69a19d1b4 (diff)
Update.
* Makefile: Add rules to build and run tst-atfork2 test. * tst-atfork2.c: New file. * tst-atfork2mod.c: New file. * sysdeps/unix/sysv/linux/unregister-atfork.c (__unregister_atfork): Free the memory allocated for the handlers after removing them from the lists. * sysdeps/unix/sysv/linux/register-atfork.c: Define memeory cleanup function. * tst-atfork1.c (do_test): Wait for the child we forked. Report error in child. * sysdeps/unix/sysv/linux/fork.c (__libc_fork): Fix comment.
Diffstat (limited to 'nptl/sysdeps/unix/sysv/linux/unregister-atfork.c')
-rw-r--r--nptl/sysdeps/unix/sysv/linux/unregister-atfork.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c b/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c
index 470f80d05c..7b3a785923 100644
--- a/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c
+++ b/nptl/sysdeps/unix/sysv/linux/unregister-atfork.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002 Free Software Foundation, Inc.
+/* Copyright (C) 2002, 2003 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
@@ -34,15 +34,27 @@ __unregister_atfork (dso_handle)
list_for_each_prev_safe (runp, prevp, &__fork_prepare_list)
if (list_entry (runp, struct fork_handler, list)->dso_handle == dso_handle)
- list_del (runp);
+ {
+ list_del (runp);
+
+ free (list_entry (runp, struct fork_handler, list));
+ }
list_for_each_prev_safe (runp, prevp, &__fork_parent_list)
if (list_entry (runp, struct fork_handler, list)->dso_handle == dso_handle)
- list_del (runp);
+ {
+ list_del (runp);
+
+ free (list_entry (runp, struct fork_handler, list));
+ }
list_for_each_prev_safe (runp, prevp, &__fork_child_list)
if (list_entry (runp, struct fork_handler, list)->dso_handle == dso_handle)
- list_del (runp);
+ {
+ list_del (runp);
+
+ free (list_entry (runp, struct fork_handler, list));
+ }
/* Release the lock. */
lll_unlock (__fork_lock);