]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
When data stack grew larger than two blocks, t_pop()ing crashed when trying
authorTimo Sirainen <tss@iki.fi>
Wed, 26 Mar 2003 14:58:33 +0000 (16:58 +0200)
committerTimo Sirainen <tss@iki.fi>
Wed, 26 Mar 2003 14:58:33 +0000 (16:58 +0200)
to free extra blocks.

--HG--
branch : HEAD

src/lib/data-stack.c

index 54c6ed353df5b913d984994d381b3a819cb0fcdd..15a830397249ab168890be9a5acbf6a1d2745281 100644 (file)
@@ -121,9 +121,13 @@ unsigned int t_push(void)
 
 static void free_blocks(struct stack_block *block)
 {
+       struct stack_block *next;
+
        /* free all the blocks, except if any of them is bigger than
           unused_block, replace it */
        while (block != NULL) {
+               next = block->next;
+
                if (unused_block == NULL || block->size > unused_block->size) {
                        free(unused_block);
                        unused_block = block;
@@ -131,7 +135,7 @@ static void free_blocks(struct stack_block *block)
                        free(block);
                }
 
-               block = block->next;
+               block = next;
        }
 }