]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: fix leak in test code
authorDavid Lamparter <equinox@opensourcerouting.org>
Wed, 29 Sep 2021 20:13:01 +0000 (22:13 +0200)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 19 Oct 2021 12:55:39 +0000 (14:55 +0200)
Even if it doesn't matter for an unit test in general, it hides actual
leaks in the code being tested.  Fix so any leaks will be actual bugs.
(Currently there aren't any, yay.)

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
tests/lib/test_typelist.h

index 379a2396b46fbd50a7952fc35298e9808b5c659e..be37a9e6c9c815930a84d61596938fed6283df98 100644 (file)
@@ -239,6 +239,13 @@ static void concat(test_, TYPE)(void)
        ts_hash_headx(
                &head, "swap2b",
                "a538546a6e6ab0484e925940aa8dd02fd934408bbaed8cb66a0721841584d838");
+
+       while (list_pop(&other))
+               ;
+       list_fini(&other);
+       prng_free(prng_swap);
+
+       ts_ref("swap-cleanup");
 #endif /* !IS_ATOMIC */
 
        k = 0;
@@ -449,6 +456,13 @@ static void concat(test_, TYPE)(void)
        ts_hash_head(
                &head, "swap2b",
                "eabfcf1413936daaf20965abced95762f45110a6619b84aac7d38481bce4ea19");
+
+       while (list_pop(&other))
+               ;
+       list_fini(&other);
+       prng_free(prng_swap);
+
+       ts_ref("swap-cleanup");
 #endif
 
        for (i = 0; i < NITEM / 2; i++) {
@@ -650,6 +664,7 @@ static void concat(test_, TYPE)(void)
        list_fini(&head);
        ts_ref("fini");
        ts_end();
+       prng_free(prng);
        printfrr("%s end\n", str(TYPE));
 }