Skip to content

Commit 1d6f3de

Browse files
committed
Tensor.Creation: Added IntPtr.Zero check for FreeHGlobalMemory
1 parent 288085b commit 1d6f3de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,7 @@ protected unsafe IntPtr CreateTensorWithoutCopying(TF_DataType dt, long[] shape,
664664
[MonoPInvokeCallback(typeof(Deallocator))]
665665
internal static void FreeHGlobalMemory(IntPtr dataPtr, IntPtr len, ref DeallocatorArgs args)
666666
{
667-
if (args.deallocator_called)
667+
if (args.deallocator_called || dataPtr == IntPtr.Zero)
668668
return;
669669

670670
// NumSharp will dispose

0 commit comments

Comments
 (0)