summaryrefslogtreecommitdiff
path: root/libexec/ld.so
diff options
context:
space:
mode:
authorDale Rahn <drahn@cvs.openbsd.org>2011-07-13 20:49:45 +0000
committerDale Rahn <drahn@cvs.openbsd.org>2011-07-13 20:49:45 +0000
commitc4c4e2eacec88eebc886b69ab13584738d2dcbc0 (patch)
treeb1fee2af650ab99fb3eb30fb0720c2cb6f4e73af /libexec/ld.so
parentfb19f2a5516be83ed21a8586e98b08ca696b401e (diff)
Delete items on grpreflist when walking them to decrement the count,
otherwise double decrement can occur. ok kurt@ timeout on other reviewers.
Diffstat (limited to 'libexec/ld.so')
-rw-r--r--libexec/ld.so/library_subr.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libexec/ld.so/library_subr.c b/libexec/ld.so/library_subr.c
index 8b9723db6be..6b0ac4848a0 100644
--- a/libexec/ld.so/library_subr.c
+++ b/libexec/ld.so/library_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: library_subr.c,v 1.33 2010/11/16 18:59:00 drahn Exp $ */
+/* $OpenBSD: library_subr.c,v 1.34 2011/07/13 20:49:44 drahn Exp $ */
/*
* Copyright (c) 2002 Dale Rahn
@@ -486,9 +486,11 @@ _dl_notify_unload_shlib(elf_object_t *object)
_dl_child_refcnt_decrement(n->data);
if (OBJECT_DLREF_CNT(object) == 0) {
- TAILQ_FOREACH(n, &object->grpref_list, next_sib) {
+ while ((n = TAILQ_FIRST(&object->grpref_list)) != NULL) {
+ TAILQ_REMOVE(&object->grpref_list, n, next_sib);
n->data->grprefcount--;
_dl_notify_unload_shlib(n->data);
+ _dl_free(n);
}
}
}