diff options
author | Jason Evans <je@fb.com> | 2011-03-15 21:25:56 (GMT) |
---|---|---|
committer | Jason Evans <je@fb.com> | 2011-03-15 21:25:56 (GMT) |
commit | 819d11be068e3f86e31db0956f5a0b29d9971e7f (patch) | |
tree | 3e41fd85aff4217426864fe79a4944f7f355225b /jemalloc/src | |
parent | 49f7e8f35ac63d0dd526cf68791dc0ca29538ac9 (diff) | |
download | jemalloc-819d11be068e3f86e31db0956f5a0b29d9971e7f.zip jemalloc-819d11be068e3f86e31db0956f5a0b29d9971e7f.tar.gz jemalloc-819d11be068e3f86e31db0956f5a0b29d9971e7f.tar.bz2 |
Add missing error checks.
Add missing error checks for pthread_mutex_init() calls. In practice,
mutex initialization never fails, so this is merely good hygiene.
Diffstat (limited to 'jemalloc/src')
-rw-r--r-- | jemalloc/src/jemalloc.c | 3 | ||||
-rw-r--r-- | jemalloc/src/rtree.c | 5 |
2 files changed, 6 insertions, 2 deletions
diff --git a/jemalloc/src/jemalloc.c b/jemalloc/src/jemalloc.c index 61a36c7..c1aadda 100644 --- a/jemalloc/src/jemalloc.c +++ b/jemalloc/src/jemalloc.c @@ -735,7 +735,8 @@ malloc_init_hard(void) */ ARENA_SET(arenas[0]); - malloc_mutex_init(&arenas_lock); + if (malloc_mutex_init(&arenas_lock)) + return (true); #ifdef JEMALLOC_PROF if (prof_boot2()) { diff --git a/jemalloc/src/rtree.c b/jemalloc/src/rtree.c index 7753743..eb440aa 100644 --- a/jemalloc/src/rtree.c +++ b/jemalloc/src/rtree.c @@ -20,7 +20,10 @@ rtree_new(unsigned bits) memset(ret, 0, offsetof(rtree_t, level2bits) + (sizeof(unsigned) * height)); - malloc_mutex_init(&ret->mutex); + if (malloc_mutex_init(&ret->mutex)) { + /* Leak the rtree. */ + return (NULL); + } ret->height = height; if (bits_per_level * height > bits) ret->level2bits[0] = bits % bits_per_level; |