From: Michael Tremer Date: Fri, 10 Jan 2025 18:01:44 +0000 (+0000) Subject: cli: Fail if the context wasn't freed in the end X-Git-Tag: 0.9.30~472 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d9a624a7aa0f766a24731a8bbcb46bcad1595b2c;p=pakfire.git cli: Fail if the context wasn't freed in the end Signed-off-by: Michael Tremer --- diff --git a/src/cli/pakfire-builder.c b/src/cli/pakfire-builder.c index d0aa30303..1e0890dc5 100644 --- a/src/cli/pakfire-builder.c +++ b/src/cli/pakfire-builder.c @@ -185,8 +185,13 @@ int main(int argc, char* argv[]) { parse, CLI_REQUIRE_ROOT, argc, argv, &args); ERROR: - if (ctx) - pakfire_ctx_unref(ctx); + if (ctx) { + ctx = pakfire_ctx_unref(ctx); + if (ctx) { + fprintf(stderr, "Context was not freed\n"); + return 1; + } + } return r; } diff --git a/src/cli/pakfire-client.c b/src/cli/pakfire-client.c index 3b99a0676..14828a108 100644 --- a/src/cli/pakfire-client.c +++ b/src/cli/pakfire-client.c @@ -98,8 +98,13 @@ int main(int argc, char* argv[]) { parse, 0, argc, argv, &args); ERROR: - if (ctx) - pakfire_ctx_unref(ctx); + if (ctx) { + ctx = pakfire_ctx_unref(ctx); + if (ctx) { + fprintf(stderr, "Context was not freed\n"); + return 1; + } + } return r; } diff --git a/src/cli/pakfire-daemon.c b/src/cli/pakfire-daemon.c index e0d1f094d..a02a372c6 100644 --- a/src/cli/pakfire-daemon.c +++ b/src/cli/pakfire-daemon.c @@ -74,8 +74,13 @@ int main(int argc, char* argv[]) { r = cli_daemon_main(ctx); ERROR: - if (ctx) - pakfire_ctx_unref(ctx); + if (ctx) { + ctx = pakfire_ctx_unref(ctx); + if (ctx) { + fprintf(stderr, "Context was not freed\n"); + return 1; + } + } return r; } diff --git a/src/cli/pakfire.c b/src/cli/pakfire.c index d83737ea5..bde3e06a6 100644 --- a/src/cli/pakfire.c +++ b/src/cli/pakfire.c @@ -169,8 +169,13 @@ int main(int argc, char* argv[]) { CLI_REQUIRE_ROOT, argc, argv, &args); ERROR: - if (ctx) - pakfire_ctx_unref(ctx); + if (ctx) { + ctx = pakfire_ctx_unref(ctx); + if (ctx) { + fprintf(stderr, "Context was not freed\n"); + return 1; + } + } return r; }