From 4bf9f92aa4b5b59cd4a83eb29a170ef6f4ff207e Mon Sep 17 00:00:00 2001 From: xiezhaokun <1016340276@qq.com> Date: Tue, 9 Jan 2024 10:45:47 +0800 Subject: [PATCH] Fix free_callback JNI weak reference leak --- native/callback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/native/callback.c b/native/callback.c index 99a9e831a3..464703ad7e 100644 --- a/native/callback.c +++ b/native/callback.c @@ -154,7 +154,7 @@ create_callback(JNIEnv* env, jobject obj, jobject method, for (i=0;i < argc;i++) { int jtype; jclass cls = (*env)->GetObjectArrayElement(env, arg_classes, i); - if ((cb->conversion_flags[i] = get_conversion_flag(env, cls)) != CVT_DEFAULT) { + if (direct && ((cb->conversion_flags[i] = get_conversion_flag(env, cls)) != CVT_DEFAULT)) { cb->arg_classes[i] = (*env)->NewWeakGlobalRef(env, cls); cvt = 1; }