summaryrefslogtreecommitdiffstats
path: root/libexec
diff options
context:
space:
mode:
authorjdp <jdp@FreeBSD.org>1999-08-20 22:33:44 +0000
committerjdp <jdp@FreeBSD.org>1999-08-20 22:33:44 +0000
commited94658ad976c19634fd21c599e94923fd5e46c9 (patch)
tree7573261b639a7b2d05639104b731572436d800c9 /libexec
parentc540cb886d0239c0ef10f6f716379ca46e03611a (diff)
downloadFreeBSD-src-ed94658ad976c19634fd21c599e94923fd5e46c9.zip
FreeBSD-src-ed94658ad976c19634fd21c599e94923fd5e46c9.tar.gz
Add a NULL pointer check whose absence could cause segmentation
violations in certain obscure cases involving failed dlopens. Many thanks to Archie Cobbs for providing me with a good test case. Eliminate a block that existed only to localize a declaration.
Diffstat (limited to 'libexec')
-rw-r--r--libexec/rtld-elf/rtld.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libexec/rtld-elf/rtld.c b/libexec/rtld-elf/rtld.c
index 796742a..f1dd696 100644
--- a/libexec/rtld-elf/rtld.c
+++ b/libexec/rtld-elf/rtld.c
@@ -22,7 +22,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: rtld.c,v 1.28 1999/07/14 04:09:11 jdp Exp $
+ * $Id: rtld.c,v 1.29 1999/07/18 00:02:19 jdp Exp $
*/
/*
@@ -1523,14 +1523,14 @@ unload_object(Obj_Entry *root, bool do_fini_funcs)
static void
unref_object_dag(Obj_Entry *root)
{
+ const Needed_Entry *needed;
+
assert(root->refcount != 0);
root->refcount--;
- if (root->refcount == 0) {
- const Needed_Entry *needed;
-
+ if (root->refcount == 0)
for (needed = root->needed; needed != NULL; needed = needed->next)
- unref_object_dag(needed->obj);
- }
+ if (needed->obj != NULL)
+ unref_object_dag(needed->obj);
}
/*
OpenPOWER on IntegriCloud