lavc/ffjni: fix local reference leak
authorMatthieu Bouron <matthieu.bouron@gmail.com>
Wed, 10 May 2017 13:57:57 +0000 (15:57 +0200)
committerMatthieu Bouron <matthieu.bouron@gmail.com>
Thu, 11 May 2017 14:28:59 +0000 (16:28 +0200)
Reviewed-by: Clément Bœsch <u@pkh.me>
libavcodec/ffjni.c

index 3f4c380..b2bcae9 100644 (file)
@@ -303,6 +303,11 @@ int ff_jni_init_jfields(JNIEnv *env, void *jfields, const struct FFJniField *jfi
 
             last_clazz = *(jclass*)((uint8_t*)jfields + jfields_mapping[i].offset) =
                     global ? (*env)->NewGlobalRef(env, clazz) : clazz;
+
+            if (global) {
+                (*env)->DeleteLocalRef(env, clazz);
+            }
+
         } else {
 
             if (!last_clazz) {