From: Michael Tremer Date: Wed, 1 Nov 2023 14:13:41 +0000 (+0000) Subject: tests: Check if context was propertly released X-Git-Tag: 0.9.30~1347 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e126402c1dd92c5c56b2ab6bc04270a6a31cd0b1;p=pakfire.git tests: Check if context was propertly released Signed-off-by: Michael Tremer --- diff --git a/tests/testsuite.c b/tests/testsuite.c index e711ecfa8..a5a2605c2 100644 --- a/tests/testsuite.c +++ b/tests/testsuite.c @@ -34,6 +34,7 @@ struct testsuite ts; static int test_run(int i, struct test* t) { + struct pakfire_ctx* ctx = NULL; struct pakfire* p = NULL; FILE* c = NULL; @@ -110,8 +111,19 @@ ERROR: t->pakfire = NULL; } - if (t->ctx) - pakfire_ctx_unref(t->ctx); + // Release context + if (t->ctx) { + ctx = pakfire_ctx_unref(t->ctx); + + // Check if the context was actually released + if (ctx) { + LOG("Error: Context was not released in test %s\n", t->name); + r = 1; + } + + // Reset pointer (just in case) + t->ctx = NULL; + } // Close the configuration file if (c)