From: Michael Tremer Date: Mon, 29 Sep 2025 17:36:56 +0000 (+0000) Subject: main: Log an error if we could not free all resources X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=77649155f36dad3c550c213d15eddcb529bfdfba;p=collecty.git main: Log an error if we could not free all resources Signed-off-by: Michael Tremer --- diff --git a/src/daemon/main.c b/src/daemon/main.c index 58a110a..de8b213 100644 --- a/src/daemon/main.c +++ b/src/daemon/main.c @@ -92,10 +92,15 @@ int main(int argc, char* argv[]) { r = collecty_daemon_run(daemon); ERROR: - if (daemon) - collecty_daemon_unref(daemon); - if (ctx) - collecty_ctx_unref(ctx); + if (daemon) { + // Log an error if the daemon was not freed properly + if (collecty_daemon_unref(daemon)) + ERROR(ctx, "Failed to free the daemon\n"); + } + if (ctx) { + if (collecty_ctx_unref(ctx)) + ERROR(ctx, "Failed to free the context\n"); + } return (r) ? EXIT_FAILURE : EXIT_SUCCESS; }