From 1c35f63797d63a1d08507ea724ec5d8898e8d76d Mon Sep 17 00:00:00 2001 From: Jason Evans Date: Wed, 11 May 2016 16:52:58 -0700 Subject: [PATCH] Guard tsdn_tsd() call with tsdn_null() check. --- src/huge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/huge.c b/src/huge.c index ba083684..1aa02a0f 100644 --- a/src/huge.c +++ b/src/huge.c @@ -67,7 +67,6 @@ huge_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize, size_t alignment, assert(ausize >= chunksize); /* Allocate an extent node with which to track the chunk. */ - assert(tsdn != NULL || arena != NULL); node = ipallocztm(tsdn, CACHELINE_CEILING(sizeof(extent_node_t)), CACHELINE, false, NULL, true, arena_ichoose(tsdn, arena)); if (node == NULL) @@ -78,7 +77,8 @@ huge_palloc(tsdn_t *tsdn, arena_t *arena, size_t usize, size_t alignment, * it is possible to make correct junk/zero fill decisions below. */ is_zeroed = zero; - arena = arena_choose(tsdn_tsd(tsdn), arena); + if (likely(!tsdn_null(tsdn))) + arena = arena_choose(tsdn_tsd(tsdn), arena); if (unlikely(arena == NULL) || (ret = arena_chunk_alloc_huge(tsdn, arena, usize, alignment, &is_zeroed)) == NULL) { idalloctm(tsdn, node, NULL, true, true);