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.
This commit is contained in:
Jason Evans 2011-03-15 14:25:56 -07:00
parent 49f7e8f35a
commit 819d11be06
2 changed files with 6 additions and 2 deletions

View File

@ -735,7 +735,8 @@ malloc_init_hard(void)
*/ */
ARENA_SET(arenas[0]); ARENA_SET(arenas[0]);
malloc_mutex_init(&arenas_lock); if (malloc_mutex_init(&arenas_lock))
return (true);
#ifdef JEMALLOC_PROF #ifdef JEMALLOC_PROF
if (prof_boot2()) { if (prof_boot2()) {

View File

@ -20,7 +20,10 @@ rtree_new(unsigned bits)
memset(ret, 0, offsetof(rtree_t, level2bits) + (sizeof(unsigned) * memset(ret, 0, offsetof(rtree_t, level2bits) + (sizeof(unsigned) *
height)); height));
malloc_mutex_init(&ret->mutex); if (malloc_mutex_init(&ret->mutex)) {
/* Leak the rtree. */
return (NULL);
}
ret->height = height; ret->height = height;
if (bits_per_level * height > bits) if (bits_per_level * height > bits)
ret->level2bits[0] = bits % bits_per_level; ret->level2bits[0] = bits % bits_per_level;