From 1d6f3de37da985575885db04c838a59f0f25020c Mon Sep 17 00:00:00 2001 From: Eli Belash Date: Fri, 30 Aug 2019 21:20:56 +0300 Subject: [PATCH] Tensor.Creation: Added IntPtr.Zero check for FreeHGlobalMemory --- src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs b/src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs index efafde27..5fa60eff 100644 --- a/src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs +++ b/src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs @@ -664,7 +664,7 @@ namespace Tensorflow [MonoPInvokeCallback(typeof(Deallocator))] internal static void FreeHGlobalMemory(IntPtr dataPtr, IntPtr len, ref DeallocatorArgs args) { - if (args.deallocator_called) + if (args.deallocator_called || dataPtr == IntPtr.Zero) return; // NumSharp will dispose