fix: fix memory leak in separator module and replace exit(1) in publicip - #2477
Merged
CarterLi merged 2 commits intoJul 24, 2026
Merged
Conversation
added 2 commits
July 24, 2026 08:48
- 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
- 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
CarterLi
force-pushed
the
fix/separator-publicip-leaks-and-exit
branch
from
July 24, 2026 00:49
b7ac175 to
2928f65
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Memory leak in separator module
ffInitSeparatorOptionscallsffStrbufInit(&options->outputColor)butffDestroySeparatorOptionswas missing the correspondingffStrbufDestroy. This leaks memory whenever a user sets a custom output color via JSON config.Fix: Added
ffStrbufDestroy(&options->outputColor)toffDestroySeparatorOptions.Aggressive
exit(1)in publicip moduleffPreparePublicIphad twoexit(1)calls:Both killed the entire process instead of propagating the error properly.
Fix: Both
exit(1)calls are replaced with setting*statusto an error string and returning. The error is properly propagated through the existing mechanism (ffDetectPublicIpalready checksif (*status != nullptr) return *status;). This matches the pattern already used in the weather module.Files changed
src/modules/separator/separator.c: Added missingffStrbufDestroy(&options->outputColor)src/detection/publicip/publicip.c: Replaced twoexit(1)calls with proper error propagation