]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: pool_alloconly_destroy() - Deduplicate code
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Tue, 23 Nov 2021 13:59:28 +0000 (14:59 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 20 Dec 2021 20:51:32 +0000 (20:51 +0000)
src/lib/mempool-alloconly.c

index 7bdda564fca06fda5eaa6931fcc913babf012710..7ff578879ea50a6568e5b578d0e5cd2ed613517c 100644 (file)
@@ -311,23 +311,11 @@ pool_alloconly_free_blocks_until_last(struct alloconly_pool *apool)
 
 static void pool_alloconly_destroy(struct alloconly_pool *apool)
 {
-       void *block;
-
        /* destroy all but the last block */
        pool_alloconly_clear(&apool->pool);
 
        /* destroy the last block */
-       block = apool->block;
-#ifdef DEBUG
-       safe_memset(block, CLEAR_CHR, SIZEOF_POOLBLOCK + apool->block->size);
-#else
-       if (apool->clean_frees) {
-               safe_memset(block, CLEAR_CHR,
-                           SIZEOF_POOLBLOCK + apool->block->size);
-       }
-#endif
-
-       free(block);
+       pool_alloconly_free_block(apool, apool->block);
 }
 
 static const char *pool_alloconly_get_name(pool_t pool ATTR_UNUSED)