[vlc-devel] [PATCH] bluray: blurayOpen(): use blurayClose() to clean up after an error

Jean-Baptiste Kempf jb at videolan.org
Sat Jan 16 18:55:42 CET 2016


Merged. Thanks.

On 16 Jan, Petri Hintukainen wrote :
> ---
>  modules/access/bluray.c | 18 ++++++++----------
>  1 file changed, 8 insertions(+), 10 deletions(-)
> 
> diff --git a/modules/access/bluray.c b/modules/access/bluray.c
> index 60b7b6c..75a2aa0 100644
> --- a/modules/access/bluray.c
> +++ b/modules/access/bluray.c
> @@ -500,16 +500,15 @@ static int blurayOpen(vlc_object_t *object)
>      /* If we're passed a block device, try to convert it to the mount point. */
>      FindMountPoint(&p_sys->psz_bd_path);
>  
> +    vlc_mutex_init(&p_sys->pl_info_lock);
> +    vlc_mutex_init(&p_sys->bdj_overlay_lock);
> +    var_AddCallback( p_demux->p_input, "intf-event", onIntfEvent, p_demux );
> +
>      p_sys->bluray = bd_open(p_sys->psz_bd_path, NULL);
>      if (!p_sys->bluray) {
> -        free(p_sys->psz_bd_path);
> -        free(p_sys);
> -        return VLC_EGENERIC;
> +        goto error;
>      }
>  
> -    vlc_mutex_init(&p_sys->pl_info_lock);
> -    vlc_mutex_init(&p_sys->bdj_overlay_lock);
> -
>      /* Warning the user about AACS/BD+ */
>      const BLURAY_DISC_INFO *disc_info = bd_get_disc_info(p_sys->bluray);
>  
> @@ -633,8 +632,6 @@ static int blurayOpen(vlc_object_t *object)
>      if (unlikely(p_sys->p_out == NULL))
>          goto error;
>  
> -    var_AddCallback( p_demux->p_input, "intf-event", onIntfEvent, p_demux );
> -
>      blurayResetParser(p_demux);
>      if (!p_sys->p_parser) {
>          msg_Err(p_demux, "Failed to create TS demuxer");
> @@ -672,8 +669,9 @@ static void blurayClose(vlc_object_t *object)
>       * This will close all the overlays before we release p_vout
>       * bd_close(NULL) can crash
>       */
> -    assert(p_sys->bluray);
> -    bd_close(p_sys->bluray);
> +    if (p_sys->bluray) {
> +        bd_close(p_sys->bluray);
> +    }
>  
>      blurayReleaseVout(p_demux);
>  
> -- 
> 2.5.0
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel

-- 
With my kindest regards,

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


More information about the vlc-devel mailing list