From: Diego Fronza Date: Thu, 1 Apr 2021 19:48:16 +0000 (-0300) Subject: Removed unnecessary check (mpctx->items == NULL) X-Git-Tag: v9.17.13~39^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=efb9c540cd0f517a5c1ff7e62883e5855d0bc35f;p=thirdparty%2Fbind9.git Removed unnecessary check (mpctx->items == NULL) There is no possibility for mpctx->items to be NULL at the point where the code was removed, since we enforce that fillcount > 0, if mpctx->items == NULL when isc_mempool_get is called, then we will allocate fillcount more items and add to the mpctx->items list. --- diff --git a/lib/isc/mem.c b/lib/isc/mem.c index a2579fbaa6d..740bffcc153 100644 --- a/lib/isc/mem.c +++ b/lib/isc/mem.c @@ -1366,15 +1366,7 @@ isc__mempool_get(isc_mempool_t *mpctx FLARG) { } } - /* - * If we didn't get any items, return NULL. - */ item = mpctx->items; - if (ISC_UNLIKELY(item == NULL)) { - atomic_fetch_sub_release(&mpctx->allocated, 1); - goto out; - } - mpctx->items = item->next; INSIST(atomic_fetch_sub_release(&mpctx->freecount, 1) > 0); @@ -1382,7 +1374,6 @@ isc__mempool_get(isc_mempool_t *mpctx FLARG) { ADD_TRACE(mpctx->mctx, item, mpctx->size, file, line); -out: MPCTXUNLOCK(mpctx); return (item);