rbus: fix coverity RESOURCE_LEAK in testSerialize #394
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.
Fix Coverity RESOURCE_LEAK in testSerialize
In the original code, rbusBuffer_Create() allocates memory for buffOut (line 51) and buffIn (line 62). When the second fopen() call fails at line 64, the function returns at line 67 without freeing these allocated buffers, causing a resource leak.
This change adds explicit rbusBuffer_Destroy() calls for both buffOut and buffIn before the early return, matching the cleanup pattern used at the end of the function (lines 90-91). All other behavior is unaffected.
Coverity Defect: Line 67 in
test/rbus/consumer/filter.c, functiontestSerialize()Coverity Issue ID: 109 (from Confluence wiki)