From 7e3d76ac62df55e4ccee06898fea8facb4679afc Mon Sep 17 00:00:00 2001 From: yushihang Date: Mon, 29 Apr 2024 21:05:37 +0800 Subject: [PATCH] add cstringFree(resultPtr) to verifyPoseidon() --- lib/identity/libs/bjj/bjj.dart | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/identity/libs/bjj/bjj.dart b/lib/identity/libs/bjj/bjj.dart index cde4d8c7..65bdfe89 100644 --- a/lib/identity/libs/bjj/bjj.dart +++ b/lib/identity/libs/bjj/bjj.dart @@ -314,6 +314,11 @@ class BabyjubjubLib { final msgPtr = msg.toNativeUtf8(); final resultPtr = _verifyPoseidon(privateKeyPtr, sigPtr, msgPtr); final String resultString = resultPtr.toDartString(); + //print("- Response string: $resultString"); + // Free the string pointer, as we already have + // an owned String to return + //print("- Freeing the native char*"); + cstringFree(resultPtr); final bool result = resultString.compareTo("1") == 0; return result; }