diff --git a/jni/jni_chacha.c b/jni/jni_chacha.c index 32948e34..0d5e6bca 100644 --- a/jni/jni_chacha.c +++ b/jni/jni_chacha.c @@ -162,6 +162,7 @@ Java_com_wolfssl_wolfcrypt_Chacha_wc_1Chacha_1process( if (ret == 0) { output = (byte*)XMALLOC(inputSz, NULL, DYNAMIC_TYPE_TMP_BUFFER); if (output == NULL) { + releaseByteArray(env, input_obj, input, JNI_ABORT); throwOutOfMemoryException(env, "Failed to allocate key buffer"); return result; } @@ -188,6 +189,7 @@ Java_com_wolfssl_wolfcrypt_Chacha_wc_1Chacha_1process( } LogStr("wc_Chacha_Process(): output = %p, ret = %d\n", output, ret); + releaseByteArray(env, input_obj, input, JNI_ABORT); XFREE(output, NULL, DYNAMIC_TYPE_TMP_BUFFER); #else throwNotCompiledInException(env);