From f872b2187ff00f347cb0a06f295eb583e91868b8 Mon Sep 17 00:00:00 2001 From: tru3 Date: Thu, 23 Jul 2026 21:49:57 +0200 Subject: [PATCH 1/2] PublicIP: replaces exit(1) with proper error status - Add missing ffStrbufDestroy(&options->outputColor) in ffDestroySeparatorOptions to prevent memory leak when outputColor is set via JSON config - Replace two exit(1) calls in ffPreparePublicIp with proper error status propagation, matching the pattern used in the weather module --- src/detection/publicip/publicip.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/detection/publicip/publicip.c b/src/detection/publicip/publicip.c index 74c592035f..a1b5ba5a95 100644 --- a/src/detection/publicip/publicip.c +++ b/src/detection/publicip/publicip.c @@ -9,8 +9,8 @@ void ffPreparePublicIp(FFPublicIPOptions* options) { FFNetworkingState* state = &states[options->ipv6]; const char** status = &statuses[options->ipv6]; if (*status != FF_UNINITIALIZED) { - fputs("Error: PublicIp module can only be used once due to internal limitations\n", stderr); - exit(1); + *status = "PublicIp module can only be used once due to internal limitations"; + return; } state->timeout = options->timeout; @@ -25,8 +25,8 @@ void ffPreparePublicIp(FFPublicIPOptions* options) { uint32_t hostStartIndex = ffStrbufFirstIndexS(&host, "://"); if (hostStartIndex < host.length) { if (hostStartIndex != 4 || !ffStrbufStartsWithIgnCaseS(&host, "http")) { - fputs("Error: only http: protocol is supported. Use `Command` module with `curl` if needed\n", stderr); - exit(1); + *status = "Only http: protocol is supported. Use `Command` module with `curl` if needed"; + return; } ffStrbufSubstrAfter(&host, hostStartIndex + (uint32_t) (strlen("://") - 1)); } From 2928f653879c8c211a5668bbbc993a2d957a7f75 Mon Sep 17 00:00:00 2001 From: tru3 Date: Thu, 23 Jul 2026 21:49:57 +0200 Subject: [PATCH 2/2] Separator: fixes memory leakes - Add missing ffStrbufDestroy(&options->outputColor) in ffDestroySeparatorOptions to prevent memory leak when outputColor is set via JSON config - Replace two exit(1) calls in ffPreparePublicIp with proper error status propagation, matching the pattern used in the weather module --- src/modules/separator/separator.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/modules/separator/separator.c b/src/modules/separator/separator.c index e0179b1e9b..733bd38e10 100644 --- a/src/modules/separator/separator.c +++ b/src/modules/separator/separator.c @@ -117,6 +117,7 @@ void ffInitSeparatorOptions(FFSeparatorOptions* options) { void ffDestroySeparatorOptions(FFSeparatorOptions* options) { ffStrbufDestroy(&options->string); + ffStrbufDestroy(&options->outputColor); } FFModuleBaseInfo ffSeparatorModuleInfo = {