]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Removed unnecessary check (mpctx->items == NULL)
authorDiego Fronza <diego@isc.org>
Thu, 1 Apr 2021 19:48:16 +0000 (16:48 -0300)
committerDiego Fronza <diego@isc.org>
Mon, 26 Apr 2021 14:32:17 +0000 (11:32 -0300)
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

index a2579fbaa6ded79af6f7eb51f8f2651296d4213c..740bffcc15371930c7e11319a16cd33a0225ecd4 100644 (file)
@@ -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);