From: Phil Carmody Date: Wed, 10 Sep 2014 11:08:58 +0000 (+0300) Subject: lib: test-aqueue - clean up the test queue each time round the loop X-Git-Tag: 2.2.14.rc1~91 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bf1683b08931a15feafe892cf5feb8c8ebb8aad9;p=thirdparty%2Fdovecot%2Fcore.git 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 --- diff --git a/src/lib/test-aqueue.c b/src/lib/test-aqueue.c index 18d9dede49..170f06b951 100644 --- a/src/lib/test-aqueue.c +++ b/src/lib/test-aqueue.c @@ -25,10 +25,11 @@ static const char *test_aqueue2(unsigned int initial_size) { 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 @@ static const char *test_aqueue2(unsigned int initial_size) 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; }