-
Notifications
You must be signed in to change notification settings - Fork 1.9k
in_forward: fix init error cleanup and parser state handling #11442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
- Reset per-message option state in forward parser to avoid stale options reuse. - Fix HELO handshake path to return error immediately on send failure. - Add NULL-check for security.users split parsing. - Use fw_config_destroy() on init failures to cleanly release allocated resources. - Align options index types/sentinels (chunk_id/metadata_id) to int for safer comparisons. Signed-off-by: Eduardo Silva <[email protected]>
📝 WalkthroughWalkthroughThis PR improves error handling and resource cleanup in the in_forward plugin. It adds validation for user configuration parsing, centralizes cleanup via a dedicated destruction function, and adjusts function signatures for consistency in type handling. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
plugins/in_forward/fw.c (1)
210-214:⚠️ Potential issue | 🟡 MinorPre-existing:
flb_mallocfailure leaks previously added users.If
flb_mallocfails here,return -1is reached without callingdelete_users(ctx). Any users already linked toctx->usersin prior loop iterations will leak, sincefw_config_destroy(called by the caller) does not clean up the users list.Proposed fix
user = flb_malloc(sizeof(struct flb_in_fw_user)); if (!user) { flb_errno(); + delete_users(ctx); return -1; }
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.
Summary by CodeRabbit