[vlc-devel] [vlc-commits] DV: check return of vlc_clone

Rémi Denis-Courmont remi at remlab.net
Mon Oct 31 07:46:36 CET 2011


On Mon, 31 Oct 2011 00:42:28 +0100 (CET), git at videolan.org (Jean-Baptiste
Kempf) wrote:
> vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Oct
28
> 13:40:43 2011 +0200| [16224f69252a4f0e0a30190a4e76cb2b4e840296] |
> committer: Jean-Baptiste Kempf
> 
> DV: check return of vlc_clone
> 
>>
http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=16224f69252a4f0e0a30190a4e76cb2b4e840296
> ---
> 
>  modules/access/dv.c |   13 +++++++++----
>  1 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/modules/access/dv.c b/modules/access/dv.c
> index d43d476..f9b7bf2 100644
> --- a/modules/access/dv.c
> +++ b/modules/access/dv.c
> @@ -206,17 +206,22 @@ static int Open( vlc_object_t *p_this )
>      p_sys->p_ev = calloc( 1, sizeof( *p_sys->p_ev ) );
>      if( !p_sys->p_ev )
>      {
> -        msg_Err( p_access, "failed to create event thread" );
> +        msg_Err( p_access, "failed to create event thread struct" );
>          Close( p_this );
> -        return VLC_EGENERIC;
> +        return VLC_ENOMEM;
>      }

Either this tries to destroy a non-existing mutex...

>  
>      p_sys->p_ev->p_frame = NULL;
>      p_sys->p_ev->pp_last = &p_sys->p_ev->p_frame;
>      p_sys->p_ev->p_access = p_access;
>      vlc_mutex_init( &p_sys->p_ev->lock );
> -    vlc_clone( &p_sys->p_ev->thread, Raw1394EventThread,
> -               p_sys->p_ev, VLC_THREAD_PRIORITY_OUTPUT );
> +    if( vlc_clone( &p_sys->p_ev->thread, Raw1394EventThread,
> +               p_sys->p_ev, VLC_THREAD_PRIORITY_OUTPUT ) )
> +    {
> +        msg_Err( p_access, "failed to clone event thread" );
> +        Close( p_this );
> +        return VLC_EGENERIC;
> +    }

...or this leaks a mutex. But at least one of them has to be wrong.

>  
>      return VLC_SUCCESS;
>  }

-- 
Rémi Denis-Courmont
http://www.remlab.net/



More information about the vlc-devel mailing list