[Android] [PATCH 13/13] libvlc: fix media leak in legacy code

Jean-Baptiste Kempf jb at videolan.org
Thu Jan 15 20:19:27 CET 2015


OK.


On 15 Jan, Thomas Guillem wrote :
> ---
>  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
> 
> _______________________________________________
> Android mailing list
> Android at videolan.org
> https://mailman.videolan.org/listinfo/android

-- 
With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device


More information about the Android mailing list