From edebe2a2bd14afa5413045efa67c0163afc57a02 Mon Sep 17 00:00:00 2001 From: deischen Date: Mon, 29 Aug 2005 13:47:42 +0000 Subject: Don't attempt to initialize the rtld lock if it can't be malloc()'d. PR: 83452 --- lib/libkse/thread/thr_rtld.c | 12 +++++++----- lib/libpthread/thread/thr_rtld.c | 12 +++++++----- 2 files changed, 14 insertions(+), 10 deletions(-) (limited to 'lib') diff --git a/lib/libkse/thread/thr_rtld.c b/lib/libkse/thread/thr_rtld.c index 9528593..e813073 100644 --- a/lib/libkse/thread/thr_rtld.c +++ b/lib/libkse/thread/thr_rtld.c @@ -160,11 +160,13 @@ _thr_rtld_lock_create(void) { struct rtld_kse_lock *l; - l = malloc(sizeof(struct rtld_kse_lock)); - _lock_init(&l->lck, LCK_ADAPTIVE, _kse_lock_wait, _kse_lock_wakeup); - l->owner = NULL; - l->count = 0; - l->write = 0; + if ((l = malloc(sizeof(struct rtld_kse_lock))) != NULL) { + _lock_init(&l->lck, LCK_ADAPTIVE, _kse_lock_wait, + _kse_lock_wakeup); + l->owner = NULL; + l->count = 0; + l->write = 0; + } return (l); } diff --git a/lib/libpthread/thread/thr_rtld.c b/lib/libpthread/thread/thr_rtld.c index 9528593..e813073 100644 --- a/lib/libpthread/thread/thr_rtld.c +++ b/lib/libpthread/thread/thr_rtld.c @@ -160,11 +160,13 @@ _thr_rtld_lock_create(void) { struct rtld_kse_lock *l; - l = malloc(sizeof(struct rtld_kse_lock)); - _lock_init(&l->lck, LCK_ADAPTIVE, _kse_lock_wait, _kse_lock_wakeup); - l->owner = NULL; - l->count = 0; - l->write = 0; + if ((l = malloc(sizeof(struct rtld_kse_lock))) != NULL) { + _lock_init(&l->lck, LCK_ADAPTIVE, _kse_lock_wait, + _kse_lock_wakeup); + l->owner = NULL; + l->count = 0; + l->write = 0; + } return (l); } -- cgit v1.1