PS-10949 Fix leaks in revoke/secret/server-info paths#25
Open
lukin-oleksiy wants to merge 2 commits intoPercona-Lab:masterfrom
Open
PS-10949 Fix leaks in revoke/secret/server-info paths#25lukin-oleksiy wants to merge 2 commits intoPercona-Lab:masterfrom
lukin-oleksiy wants to merge 2 commits intoPercona-Lab:masterfrom
Conversation
|
@lukin-oleksiy Thank you for fixing this quickly. Can you please revert the code change but keep tests to show that your new tests fail with ASAN (without code fix)? Please paste the trace reported by the tool? |
https://perconadev.atlassian.net/browse/PS-10949 libkmip/src/kmip.c: adds missing free paths to prevent decode-time leaks: new kmip_free_secret_data(...) new kmip_free_revoke_request_payload(...) new kmip_free_revoke_response_payload(...) wires these into existing dispatch in kmip_free_get_response_payload, kmip_free_request_batch_item, and kmip_free_response_batch_item for KMIP_OBJTYPE_SECRET_DATA and KMIP_OP_REVOKE. libkmip/include/kmip.h: exports kmip_free_secret_data(...) declaration. libkmip/src/tests.c: adds regression tests for decode paths that were leaking: test_decode_get_response_payload_secret_data test_decode_response_batch_item_revoke_payload both added to run_tests(). libkmip/src/CMakeLists.txt: introduces ASAN/LSAN test executable kmip_tests_asan and custom target run_tests_asan with leak detection enabled. README.md: updates usage docs with CMake build/run instructions and adds a “Run Tests (ASAN)” section showing run_tests_asan.
https://perconadev.atlassian.net/browse/PS-10949 libkmip/src/kmip.c kmip_free_server_information was expanded from shallow field cleanup to full owned-memory cleanup. Adds a null guard (ctx/value) and explicitly frees each allocated TextString * field pointer after kmip_free_text_string. Adds cleanup for alternative_failover_endpoints, including draining/freing endpoint_list items and container allocations. Adds KMIP_OP_GET handling in kmip_encode_response_batch_item to encode GetResponsePayload (previously missing in that switch). libkmip/src/tests.c In test_encode_query_request_payload, adds kmip_destroy(&ctx) before return, fixing leaked test context memory. Net effect: this commit closes additional ASAN-reported leaks in server-info/test code paths and fixes missing GET response-payload encoding dispatch.
6edd05a to
2301151
Compare
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.
PS-10949 Fix leaks in revoke/secret/server-info paths; encode GET responses
https://perconadev.atlassian.net/browse/PS-10949
The summary of fixes from the 1st commit :
PS-10949 Fix revoke/SecretData decode leaks and add ASAN test target
The second commit fixes other leaks detected by tests.c run with ASAN:
PS-10949 Fix remaining leask detected by ASAN test target