Commit 53fd6bc7 authored by Andrew Twyman's avatar Andrew Twyman

Add LocalRefGuard to avoid leaking in jniFindClass

parent 49c86532
......@@ -177,7 +177,7 @@ void jniThrowAssertionError(JNIEnv * env, const char * file, int line, const cha
GlobalRef<jclass> jniFindClass(const char * name) {
JNIEnv * env = jniGetThreadEnv();
DJINNI_ASSERT(name, env);
GlobalRef<jclass> guard(env, env->FindClass(name));
GlobalRef<jclass> guard(env, LocalRef<jclass>(env, env->FindClass(name)).get());
jniExceptionCheck(env);
if (!guard) {
jniThrowAssertionError(env, __FILE__, __LINE__, "FindClass returned null");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment