[Android] libvlcjni: fix local ref leak

Thomas Guillem git at videolan.org
Thu Apr 2 13:44:28 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu Apr  2 13:43:35 2015 +0200| [fce465410e3834427357d0bd845274df9242532b] | committer: Thomas Guillem

libvlcjni: fix local ref leak

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=fce465410e3834427357d0bd845274df9242532b
---

 libvlc/jni/libvlcjni.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libvlc/jni/libvlcjni.c b/libvlc/jni/libvlcjni.c
index 8be824d..5e41658 100644
--- a/libvlc/jni/libvlcjni.c
+++ b/libvlc/jni/libvlcjni.c
@@ -153,6 +153,7 @@ static void vlc_event_callback(const libvlc_event_t *ev, void *data)
     jmethodID putLong = (*env)->GetMethodID(env, clsBundle, "putLong", "(Ljava/lang/String;J)V" );
     jmethodID putFloat = (*env)->GetMethodID(env, clsBundle, "putFloat", "(Ljava/lang/String;F)V" );
     jmethodID putString = (*env)->GetMethodID(env, clsBundle, "putString", "(Ljava/lang/String;Ljava/lang/String;)V" );
+    (*env)->DeleteLocalRef(env, clsBundle);
 
     if (ev->type == libvlc_MediaPlayerPositionChanged) {
         jstring sData = (*env)->NewStringUTF(env, "data");
@@ -211,6 +212,7 @@ static void vlc_event_callback(const libvlc_event_t *ev, void *data)
     } else {
         LOGE("EventHandler: failed to get the callback method");
     }
+    (*env)->DeleteLocalRef(env, cls);
 
 end:
     (*env)->DeleteLocalRef(env, bundle);



More information about the Android mailing list