dovecot-2.2: lib: test-aqueue - clean up the test queue each tim...

dovecot at dovecot.org dovecot at dovecot.org
Wed Sep 10 11:11:36 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/e1eaf5d06769
changeset: 17779:e1eaf5d06769
user:      Phil Carmody <phil at dovecot.fi>
date:      Wed Sep 10 14:08:58 2014 +0300
description:
lib: test-aqueue - clean up the test queue each time round the loop
Helps keep noise out of memory leak debugging during unit tests.

Signed-off-by: Phil Carmody <phil at dovecot.fi>

diffstat:

 src/lib/test-aqueue.c |  10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diffs (32 lines):

diff -r e5028f632d1c -r e1eaf5d06769 src/lib/test-aqueue.c
--- a/src/lib/test-aqueue.c	Wed Sep 10 14:08:58 2014 +0300
+++ b/src/lib/test-aqueue.c	Wed Sep 10 14:08:58 2014 +0300
@@ -25,10 +25,11 @@
 {
 	ARRAY(unsigned int) aqueue_array;
 	unsigned int i, j, k;
-	struct aqueue *aqueue;
 
 	for (i = 0; i < N_ELEMENTS(aqueue_input); i++) {
 		for (k = 0; k < N_ELEMENTS(aqueue_input); k++) {
+			struct aqueue *aqueue;
+
 			t_array_init(&aqueue_array, initial_size);
 			aqueue = aqueue_init(&aqueue_array.arr);
 			aqueue->head = aqueue->tail = initial_size - 1;
@@ -49,11 +50,12 @@
 				if (!aqueue_is_ok(aqueue, i))
 					return "Invalid data after delete";
 			}
+			aqueue_clear(aqueue);
+			if (aqueue_count(aqueue) != 0)
+				return "aqueue_clear() broken";
+			aqueue_deinit(&aqueue);
 		}
 	}
-	aqueue_clear(aqueue);
-	if (aqueue_count(aqueue) != 0)
-		return "aqueue_clear() broken";
 	return NULL;
 }
 


More information about the dovecot-cvs mailing list