Skip to content

Commit

Permalink
Fix free_callback JNI weak reference leak
Browse files Browse the repository at this point in the history
  • Loading branch information
xiezhaokun committed Jan 9, 2024
1 parent 1dd63c8 commit 7f0634d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion native/callback.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,9 @@ free_callback(JNIEnv* env, callback *cb) {
free(cb->arg_types);
if (cb->arg_classes) {
unsigned i;
for (i=0;i < cb->cif.nargs;i++) {
jsize argc;
argc = (*env)->GetArrayLength(env, arg_classes);
for (i=0;i < argc;i++) {
if (cb->arg_classes[i]) {
(*env)->DeleteWeakGlobalRef(env, cb->arg_classes[i]);
}
Expand Down

0 comments on commit 7f0634d

Please sign in to comment.