Skip to content

Commit

Permalink
Tensor.Creation: Added IntPtr.Zero check for FreeHGlobalMemory
Browse files Browse the repository at this point in the history
  • Loading branch information
Nucs committed Aug 30, 2019
1 parent 288085b commit 1d6f3de
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/TensorFlowNET.Core/Tensors/Tensor.Creation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -664,7 +664,7 @@ protected unsafe IntPtr CreateTensorWithoutCopying(TF_DataType dt, long[] shape,
[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
Expand Down

0 comments on commit 1d6f3de

Please sign in to comment.