]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: test-aqueue - clean up the test queue each time round the loop
authorPhil Carmody <phil@dovecot.fi>
Wed, 10 Sep 2014 11:08:58 +0000 (14:08 +0300)
committerPhil Carmody <phil@dovecot.fi>
Wed, 10 Sep 2014 11:08:58 +0000 (14:08 +0300)
Helps keep noise out of memory leak debugging during unit tests.

Signed-off-by: Phil Carmody <phil@dovecot.fi>
src/lib/test-aqueue.c

index 18d9dede49cb3169efaecc7af71ee3a8353a4545..170f06b95104d5863b03c96b97203fdd6e1019a1 100644 (file)
@@ -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;
 }