summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjdolecek <jdolecek@NetBSD.org>2000-06-02 22:52:28 +0000
committerjdolecek <jdolecek@NetBSD.org>2000-06-02 22:52:28 +0000
commit2a05365bbb5e42a915f852331586a8ea281ec0ca (patch)
tree5b728f3ef9907450b80e4cf165f0bb259d7348d5
parent97b236dc90856e8ec0d3a91f2a1031e9b9846c6f (diff)
_rtld_unref_dag(): needed->obj might be null if the unreffed object has
some unsatisfied references (most often when compiled without necessary -Wl,-R), so check for that instead of causing null-dereference; this way the code has a chance to cleanup after itself and report the error to caller Thanks to Jason Thorpe for helping fix this!
-rw-r--r--libexec/ld.elf_so/rtld.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libexec/ld.elf_so/rtld.c b/libexec/ld.elf_so/rtld.c
index e31654f6923..d933a7183f4 100644
--- a/libexec/ld.elf_so/rtld.c
+++ b/libexec/ld.elf_so/rtld.c
@@ -1,4 +1,4 @@
-/* $NetBSD: rtld.c,v 1.31 2000/04/15 05:41:46 erh Exp $ */
+/* $NetBSD: rtld.c,v 1.32 2000/06/02 22:52:28 jdolecek Exp $ */
/*
* Copyright 1996 John D. Polstra.
@@ -594,13 +594,16 @@ _rtld_unref_dag(root)
Obj_Entry *root;
{
assert(root->refcount != 0);
+ assert(root);
--root->refcount;
if (root->refcount == 0) {
const Needed_Entry *needed;
for (needed = root->needed; needed != NULL;
- needed = needed->next)
- _rtld_unref_dag(needed->obj);
+ needed = needed->next) {
+ if (needed->obj != NULL)
+ _rtld_unref_dag(needed->obj);
+ }
}
}