Repository navigation
test_node_graph: release arrays when the mocked fini fails - #3454
Merged
Merged
Conversation
Tests that make rcl_names_and_types_fini(), rcutils_string_array_fini() or rcl_topic_endpoint_info_array_fini() fail leave the array allocated by the code under test unreleased, which LeakSanitizer reports. Have the replacement functions free the memory before returning the error. Signed-off-by: Michael Carroll <mjcarroll.oss@gmail.com>
ABI Compliance Check✅ Verdict: compatible
✅
|
This was referenced Nov 29, 2026
Member
Author
This was referenced Nov 29, 2026
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.
Description
The
test_node_graphtests that makercl_names_and_types_fini(),rcutils_string_array_fini()orrcl_topic_endpoint_info_array_fini()fail on purpose never release the array the code under test allocated, so LeakSanitizer reports 18 leaks intest_node_interfaces__node_graph.The replacement functions now free the memory before returning the error.
rcl_names_and_types_fini()andrcl_topic_endpoint_info_array_fini()are the rmw functions under another name, so the replacements can't call them (the mock would recurse) and usermw_names_and_types_fini()and a manual cleanup instead.Test only. Found with AddressSanitizer, which is clean for this target after the change.
Is this user-facing behavior change?
No.
Did you use Generative AI?
Yes, Claude Code, for finding the cause and writing the change.
Additional Information
Tested with and without AddressSanitizer.