summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2005-08-29 13:47:42 +0000
committerdeischen <deischen@FreeBSD.org>2005-08-29 13:47:42 +0000
commitedebe2a2bd14afa5413045efa67c0163afc57a02 (patch)
tree9b02283d205318431f8306bc294216256da7c709 /lib
parente8b11bb2ef203a9c1e215689e011a8f46a73a331 (diff)
downloadFreeBSD-src-edebe2a2bd14afa5413045efa67c0163afc57a02.zip
FreeBSD-src-edebe2a2bd14afa5413045efa67c0163afc57a02.tar.gz
Don't attempt to initialize the rtld lock if it can't be malloc()'d.
PR: 83452
Diffstat (limited to 'lib')
-rw-r--r--lib/libkse/thread/thr_rtld.c12
-rw-r--r--lib/libpthread/thread/thr_rtld.c12
2 files changed, 14 insertions, 10 deletions
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);
}
OpenPOWER on IntegriCloud