]> git.ipfire.org Git - collecty.git/commitdiff
main: Log an error if we could not free all resources
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 29 Sep 2025 17:36:56 +0000 (17:36 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 29 Sep 2025 17:36:56 +0000 (17:36 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/main.c

index 58a110a07bc58f27a12b46fd1a833b5e3dccdaab..de8b213d0f20bf7cc371133485fc65762e0c70d4 100644 (file)
@@ -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;
 }