Fix memory leak in LLVMFuzzerTestOneInput when Initialize() fails#5202
Merged
Conversation
Co-authored-by: guhetier <15261469+guhetier@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Potential memory leak in LLVMFuzzerTestOneInput When Initialization Fails
Fix memory leak in LLVMFuzzerTestOneInput when Initialize() fails
Jun 30, 2025
guhetier
marked this pull request as ready for review
June 30, 2025 18:05
nibanks
previously approved these changes
Jul 1, 2025
Collaborator
This test seems to have consistently regressed recently. It isn't specific to this PR though. |
mtfriesen
previously approved these changes
Jul 7, 2025
Co-authored-by: mtfriesen <3517159+mtfriesen@users.noreply.github.com>
nibanks
approved these changes
Jul 8, 2025
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #5202 +/- ##
==========================================
+ Coverage 85.53% 86.23% +0.69%
==========================================
Files 59 59
Lines 18330 18330
==========================================
+ Hits 15679 15807 +128
+ Misses 2651 2523 -128 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
mtfriesen
approved these changes
Jul 9, 2025
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 memory leak in the
LLVMFuzzerTestOneInputfunction insrc/tools/spin/spinquic.cpp.Issue:
When
FuzzData->Initialize()returns false, the function exits early without deallocating theFuzzDataobject that was allocated withnew, causing a memory leak on every such input.Root Cause:
Fix:
Added
delete FuzzData;before the early return to ensure proper cleanup:Verification:
delete FuzzData;at the end)recvfuzz.cppwhich doesn't have this issue due to simpler constructor patternFixes #5201.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.