[dovecot-cvs] dovecot/src/lib data-stack.c,1.17,1.18

cras at procontrol.fi cras at procontrol.fi
Wed Mar 26 16:58:35 EET 2003


Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv26265

Modified Files:
	data-stack.c 
Log Message:
When data stack grew larger than two blocks, t_pop()ing crashed when trying
to free extra blocks.



Index: data-stack.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/data-stack.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- data-stack.c	27 Jan 2003 00:46:29 -0000	1.17
+++ data-stack.c	26 Mar 2003 14:58:33 -0000	1.18
@@ -121,9 +121,13 @@
 
 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 @@
 			free(block);
 		}
 
-		block = block->next;
+		block = next;
 	}
 }
 




More information about the dovecot-cvs mailing list