From 6c1afe11426410d7094e8aa7eb37412f62f0373e Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Wed, 14 Oct 2020 15:10:12 -0700 Subject: [PATCH] Fix comparison to intPtr.Zero. The current implementation is allowed by a Roslyn bug that's preserved for backcompat. --- WinRT.Runtime/Marshalers.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/WinRT.Runtime/Marshalers.cs b/WinRT.Runtime/Marshalers.cs index b74c4e893..21de81f11 100644 --- a/WinRT.Runtime/Marshalers.cs +++ b/WinRT.Runtime/Marshalers.cs @@ -124,7 +124,7 @@ public void Dispose() marshaler?.Dispose(); } } - if (_array != null) + if (_array != IntPtr.Zero) { Marshal.FreeCoTaskMem(_array); } @@ -442,7 +442,7 @@ public void Dispose() Marshaler.DisposeMarshaler(marshaler); } } - if (_array != null) + if (_array != IntPtr.Zero) { Marshal.FreeCoTaskMem(_array); } @@ -624,7 +624,7 @@ public void Dispose() DisposeMarshaler(marshaler); } } - if (_array != null) + if (_array != IntPtr.Zero) { Marshal.FreeCoTaskMem(_array); }