Skip to content
This repository was archived by the owner on Feb 12, 2026. It is now read-only.

Commit 43acc1f

Browse files
Fix memory leak by releasing JNI global refs in legacy_callbacks (#12)
This commit as been taken from LSPosed-Irena.
1 parent 6b980fd commit 43acc1f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

core/src/main/jni/src/jni/hook_bridge.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ LSP_DEF_NATIVE_METHOD(jboolean, HookBridge, unhookMethod, jboolean useModernApi,
154154
} else {
155155
for (auto i = hook_item->legacy_callbacks.begin(); i != hook_item->legacy_callbacks.end(); ++i) {
156156
if (env->IsSameObject(i->second, callback)) {
157+
env->DeleteGlobalRef(i->second);
157158
hook_item->legacy_callbacks.erase(i);
158159
return JNI_TRUE;
159160
}

0 commit comments

Comments
 (0)