From 5cb00a8924a899b538db0b6a55093125a9fec6bd Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 2 Jul 2022 16:17:33 +0200 Subject: [PATCH] Fix use-after-free with ID3D12InfoQueue messages --- .../Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs index dff79a89..38bc3787 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs @@ -160,17 +160,17 @@ partial class DeviceHelper { builder.Append($"[Description]: \"{new string(message->pDescription)}\""); } + + if (message->Severity is D3D12_MESSAGE_SEVERITY_ERROR or D3D12_MESSAGE_SEVERITY_CORRUPTION or D3D12_MESSAGE_SEVERITY_WARNING) + { + hasErrorsOrWarnings = true; + } } finally { NativeMemory.Free(message); } - if (message->Severity is D3D12_MESSAGE_SEVERITY_ERROR or D3D12_MESSAGE_SEVERITY_CORRUPTION or D3D12_MESSAGE_SEVERITY_WARNING) - { - hasErrorsOrWarnings = true; - } - Trace.WriteLine(builder); }