[Android] [PATCH 13/13] libvlc: fix media leak in legacy code
Thomas Guillem
thomas at gllm.fr
Thu Jan 15 19:22:30 CET 2015
---
libvlc/jni/libvlcjni.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/libvlc/jni/libvlcjni.c b/libvlc/jni/libvlcjni.c
index 033c47c..fd89836 100644
--- a/libvlc/jni/libvlcjni.c
+++ b/libvlc/jni/libvlcjni.c
@@ -726,6 +726,7 @@ jstring Java_org_videolan_libvlc_LibVLC_getMeta(JNIEnv *env, jobject thiz, int m
string = (*env)->NewStringUTF(env, psz_meta);
free(psz_meta);
}
+ libvlc_media_release(p_mp);
return string;
}
@@ -801,10 +802,17 @@ static int expand_media_internal(JNIEnv *env, libvlc_instance_t* p_instance, job
}
jint Java_org_videolan_libvlc_LibVLC_expandMedia(JNIEnv *env, jobject thiz, jobject children) {
- return (jint)expand_media_internal(env,
+ jint ret;
+ libvlc_media_t *p_md = libvlc_media_player_get_media(getMediaPlayer(env, thiz));
+
+ if (!p_md)
+ return -1;
+ ret = (jint)expand_media_internal(env,
getLibVlcInstance(env, thiz),
children,
- (libvlc_media_t*)libvlc_media_player_get_media(getMediaPlayer(env, thiz)));
+ p_md);
+ libvlc_media_release(p_md);
+ return ret;
}
// TODO: remove static variables
--
2.1.3
More information about the Android
mailing list