diff --git a/src/Neo.Cryptography.BLS12_381/GObject.cs b/src/Neo.Cryptography.BLS12_381/GObject.cs index bafebb4..c719239 100644 --- a/src/Neo.Cryptography.BLS12_381/GObject.cs +++ b/src/Neo.Cryptography.BLS12_381/GObject.cs @@ -34,20 +34,8 @@ public GObject(byte[] g) { try { - switch (type) - { - case GType.G1: - Interop.g1_dispose(ptr); - break; - case GType.G2: - Interop.g2_dispose(ptr); - break; - case GType.Gt: - Interop.gt_dispose(ptr); - break; - default: - throw new Exception($"Bls12381 operation fault, type:format, error:type mismatch"); - } + Marshal.FreeHGlobal(ptr); + //ptr = IntPtr.Zero; } catch (Exception) { diff --git a/src/Neo.Cryptography.BLS12_381/Interop.cs b/src/Neo.Cryptography.BLS12_381/Interop.cs index 873d057..264bfc6 100644 --- a/src/Neo.Cryptography.BLS12_381/Interop.cs +++ b/src/Neo.Cryptography.BLS12_381/Interop.cs @@ -32,15 +32,6 @@ internal static class Interop [DllImport("Neo_Cryptography_BLS12_381_Native", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr g2_neg(IntPtr g2); - [DllImport("Neo_Cryptography_BLS12_381_Native", CallingConvention = CallingConvention.Cdecl)] - public static extern void gt_dispose(IntPtr rawPtr); - - [DllImport("Neo_Cryptography_BLS12_381_Native", CallingConvention = CallingConvention.Cdecl)] - public static extern void g1_dispose(IntPtr rawPtr); - - [DllImport("Neo_Cryptography_BLS12_381_Native", CallingConvention = CallingConvention.Cdecl)] - public static extern void g2_dispose(IntPtr rawPtr); - [DllImport("Neo_Cryptography_BLS12_381_Native", CallingConvention = CallingConvention.Cdecl)] public static extern IntPtr g1_g2_pairing(IntPtr g1, IntPtr g2);