Skip to content

Commit

Permalink
Fix memory lead found in public key in kmp binding (#4097)
Browse files Browse the repository at this point in the history
  • Loading branch information
10gic authored Nov 6, 2024
1 parent c61daac commit 0479584
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion jni/cpp/TWJNIData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,7 @@ jbyteArray TWDataJByteArray(TWData *_Nonnull data, JNIEnv *env) {
TWData *_Nonnull TWDataCreateWithJByteArray(JNIEnv *env, jbyteArray _Nonnull array) {
jsize size = env->GetArrayLength(array);
jbyte *bytes = env->GetByteArrayElements(array, nullptr);
return TWDataCreateWithBytes((uint8_t *) bytes, size);
const auto *twdata = TWDataCreateWithBytes((uint8_t *) bytes, size);
env->ReleaseByteArrayElements(array, bytes, JNI_ABORT);
return twdata;
}

0 comments on commit 0479584

Please sign in to comment.