]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: Fix data_stack_get_alloc_size() and data_stack_get_used_size()
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 6 Oct 2021 10:20:12 +0000 (13:20 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 6 Oct 2021 10:28:27 +0000 (13:28 +0300)
It only worked correctly if data stack hadn't been grown. This resulted
in wrong numbers in the data_stack_grow event.

src/lib/data-stack.c

index 1f68583ab28380df2b261a33405b58e75103142f..df13b3c9681ddda18d1412645f42948c2c98b409 100644 (file)
@@ -714,7 +714,7 @@ size_t data_stack_get_alloc_size(void)
        i_assert(current_block->next == NULL);
 
        for (block = current_block; block != NULL; block = block->prev)
-               size += current_block->size;
+               size += block->size;
        return size;
 }
 
@@ -726,7 +726,7 @@ size_t data_stack_get_used_size(void)
        i_assert(current_block->next == NULL);
 
        for (block = current_block; block != NULL; block = block->prev)
-               size += current_block->size - current_block->left;
+               size += block->size - block->left;
        return size;
 }