Fix assert in free fastpath

rtree_szind_slab_read_fast() may have not initialized
alloc_ctx.szind, unless after confirming the return is true.
This commit is contained in:
Yinan Zhang 2019-05-15 07:50:10 -07:00 committed by Qi Wang
parent 259b15dec5
commit 13e88ae970

View File

@ -2744,12 +2744,12 @@ bool free_fastpath(void *ptr, size_t size, bool size_hint) {
bool res = rtree_szind_slab_read_fast(tsd_tsdn(tsd), &extents_rtree, bool res = rtree_szind_slab_read_fast(tsd_tsdn(tsd), &extents_rtree,
rtree_ctx, (uintptr_t)ptr, rtree_ctx, (uintptr_t)ptr,
&alloc_ctx.szind, &alloc_ctx.slab); &alloc_ctx.szind, &alloc_ctx.slab);
assert(alloc_ctx.szind != SC_NSIZES);
/* Note: profiled objects will have alloc_ctx.slab set */ /* Note: profiled objects will have alloc_ctx.slab set */
if (!res || !alloc_ctx.slab) { if (!res || !alloc_ctx.slab) {
return false; return false;
} }
assert(alloc_ctx.szind != SC_NSIZES);
} else { } else {
/* /*
* Check for both sizes that are too large, and for sampled objects. * Check for both sizes that are too large, and for sampled objects.