From efb9c540cd0f517a5c1ff7e62883e5855d0bc35f Mon Sep 17 00:00:00 2001 From: Diego Fronza Date: Thu, 1 Apr 2021 16:48:16 -0300 Subject: [PATCH] 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. --- lib/isc/mem.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/isc/mem.c b/lib/isc/mem.c index a2579fbaa6..740bffcc15 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);