Skip to content

stream_processor: sp_stream: Plug unfreed allocated memories on exceptions - #12277

Merged
edsiper merged 1 commit into
masterfrom
cosmo0920-ensure-freeing-on-exceptions
Aug 14, 2026
Merged

stream_processor: sp_stream: Plug unfreed allocated memories on exceptions#12277
edsiper merged 1 commit into
masterfrom
cosmo0920-ensure-freeing-on-exceptions

Conversation

@cosmo0920

@cosmo0920 cosmo0920 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Closes #12204.


Enter [N/A] in the box, if an item is not applicable to your change.

Testing
Before we can approve your change; please submit the following in a comment:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

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

  • Bug Fixes
    • Improved cleanup when stream input initialization fails, helping prevent resource leaks and improving application stability.

…tions

Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
@coderabbitai

coderabbitai Bot commented Aug 13, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: cf5dcdc8-f2cd-4743-96cf-ee88617ade88

📥 Commits

Reviewing files that changed from the base of the PR and between ae51533 and a87d874.

📒 Files selected for processing (1)
  • src/stream_processor/flb_sp_stream.c

📝 Walkthrough

Walkthrough

The stream processor now frees the stream name, tag, and structure when input instance initialization fails, then returns an error.

Changes

Stream initialization

Layer / File(s) Summary
Initialization failure cleanup
src/stream_processor/flb_sp_stream.c
The failure path releases the stream name, tag, and structure, then returns -1.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Mergeability Score: ⚪ Minimal · up to a87d8

This is a localized memory-cleanup change with no actionable merge-blocking risk remaining after normal checks and review.

Suggested reviewers: koleini

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the stream processor memory cleanup change on initialization exceptions.
Linked Issues check ✅ Passed The change releases stream metadata and returns after input initialization failure, preventing stale-pointer use and repeated destruction in issue #12204.
Out of Scope Changes check ✅ Passed The four added cleanup statements directly address the linked issue and the stated failure path; no unrelated changes are shown.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cosmo0920-ensure-freeing-on-exceptions

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cosmo0920 cosmo0920 added this to the Fluent Bit v5.1.1 milestone Aug 13, 2026
@edsiper
edsiper merged commit ab98365 into master Aug 14, 2026
60 of 62 checks passed
@edsiper
edsiper deleted the cosmo0920-ensure-freeing-on-exceptions branch August 14, 2026 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stream_processor: destroyed input instance is used after initialization failure

2 participants