filter_log_to_metrics: fix initialization and exception cleanup#11428
filter_log_to_metrics: fix initialization and exception cleanup#11428
Conversation
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the
✨ 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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3b42f9864
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (ret == -1) { | ||
| flb_errno(); | ||
| flb_plg_error(f_ins, "cannot initialize metrics emitter instance."); | ||
| log_to_metrics_destroy(ctx); | ||
| return -1; |
There was a problem hiding this comment.
Clean up emitter/context on init failure
When flb_input_instance_init (or later storage init) fails, cb_log_to_metrics_init now returns -1 without tearing down the partially created emitter instance or freeing the filter context. flb_filter_init_all only calls flb_filter_instance_destroy on init failure and never runs cb_exit, so those allocations (including the emitter input instance) leak for configs that hit this error path (e.g., invalid emitter setup or storage init failure). Consider restoring log_to_metrics_destroy(ctx) (or equivalent cleanup) on these failure returns.
Useful? React with 👍 / 👎.
Backport of #11420
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.