Skip to content

Commit

Permalink
[bug] Fix memory leak in dxil validator (#4966)
Browse files Browse the repository at this point in the history
We would create the dxil runtime reflection object but never free it.
Using a unique_ptr here does the job.

Found by running external tests with appverifier enabled.

(cherry picked from commit 661f7ce)
  • Loading branch information
dmpots authored and pow2clk committed Feb 24, 2023
1 parent 87fc5b5 commit 073d860
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/HLSL/DxilValidation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5563,7 +5563,7 @@ static void VerifyRDATMatches(_In_ ValidationContext &ValCtx,
VerifyBlobPartMatches(ValCtx, PartName, pWriter.get(), pRDATData, RDATSize);

// Verify no errors when runtime reflection from RDAT:
RDAT::DxilRuntimeReflection *pReflection = RDAT::CreateDxilRuntimeReflection();
unique_ptr<RDAT::DxilRuntimeReflection> pReflection(RDAT::CreateDxilRuntimeReflection());
if (!pReflection->InitFromRDAT(pRDATData, RDATSize)) {
ValCtx.EmitFormatError(ValidationRule::ContainerPartMatches, { PartName });
return;
Expand Down

0 comments on commit 073d860

Please sign in to comment.