Fix Windows Debug crash caused by cross-allocator free of Rust inputfile strings#2129
Merged
cfsmp3 merged 2 commits intoCCExtractor:masterfrom Feb 20, 2026
Merged
Conversation
On Windows Debug builds, freeing inputfile in dinit_libraries() causes a _CrtIsValidHeapPointer assertion failure. The root cause was that the inputfile strings and the array are allocated in Rust using CString::into_raw() and Vec, which use Rust's global allocator. They were later freed in C using free(), causing a cross-allocator mismatch detected by the MSVC Debug CRT. The fix is to replace manual free() calls with free_rust_c_string_array() so that rust allocated memory is released using the correct allocator.
Collaborator
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 2dc5cf3...:
Your PR breaks these cases:
Congratulations: Merging this PR would fix the following tests:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
Collaborator
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 185631d...:
Your PR breaks these cases:
Congratulations: Merging this PR would fix the following tests:
It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you). Check the result page for more info. |
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.
This PR fixes a crash that occurs on Windows Debug builds when freeing inputfile inside dinit_libraries().
Problem:
They were later freed in C using free(), which caused a cross-allocator mismatch.
on msvc debug builds this triggered a _CrtIsValidHeapPointer assertion.
FIx:
Replaced the manual free() calls in dinit_libraries() with
free_rust_c_string_array(), ensuring Rust-allocated memory is freed using Rust’s allocator.
The Rust function is exported with extern "C" to allow proper linkage from C.
Testing:
Verified on Windows x64 Debug build
No _CrtIsValidHeapPointer assertion
Tested with single and multiple input files