logging: prevent double-free multi-threaded logging v1.1 - #16137
Closed
lukashino wants to merge 1 commit into
Closed
logging: prevent double-free multi-threaded logging v1.1#16137lukashino wants to merge 1 commit into
lukashino wants to merge 1 commit into
Conversation
When multithreaded output was enabled, all threads freed shallow-copy of sensor and prefix names. This commit adds a guard so that only the parent frees the allocated buffers. Ticket: 8861
There was a problem hiding this comment.
Pull request overview
This PR fixes a shutdown/cleanup double-free in multithreaded logging by ensuring that only the “parent” LogFileCtx frees shared (shallow-copied) buffers like prefix and sensor_name, preventing leaf thread contexts from freeing the same allocations.
Changes:
- Guard freeing of
lf_ctx->prefix/lf_ctx->sensor_nameso it only happens whenlf_ctx->parent == NULL. - Keep existing threaded-leaf cleanup behavior intact while avoiding shared-buffer double free.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16137 +/- ##
==========================================
+ Coverage 83.05% 83.09% +0.03%
==========================================
Files 1004 1004
Lines 277407 277408 +1
==========================================
+ Hits 230410 230519 +109
+ Misses 46997 46889 -108
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
victorjulien
approved these changes
Aug 28, 2026
|
Information: QA ran without warnings. Pipeline = 33426 |
Merged
Member
|
Merged in #16141, thanks! |
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.
Follow-up of the pre-approved #16057 (got blocked by SV tests)
When multithreaded output was enabled, all threads freed shallow-copy of sensor and prefix names.
This commit adds a guard so that only the parent frees the allocated buffers.
Ticket: https://redmine.openinfosecfoundation.org/issues/8861
SV_REPO=
SV_BRANCH=OISF/suricata-verify#3330
SU_REPO=
SU_BRANCH=
Describe changes:
v1.1: