[vlc-devel] vo/xcb: fix a memory leak in Open()

Rafaël Carré rafael.carre at gmail.com
Mon Jul 18 14:34:00 CEST 2011


Le Mon, 18 Jul 2011 15:46:02 +0800,
Can Wu <wu.canus at gmail.com> a écrit :

> ---
>  modules/video_output/xcb/xvideo.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
> 
> diff --git a/modules/video_output/xcb/xvideo.c
> b/modules/video_output/xcb/xvideo.c index b7e0339..294d61a 100644
> --- a/modules/video_output/xcb/xvideo.c
> +++ b/modules/video_output/xcb/xvideo.c
> @@ -303,7 +303,10 @@ static int Open (vlc_object_t *obj)
>      vout_display_sys_t *p_sys = malloc (sizeof (*p_sys));
>  
>      if (!var_InheritBool (obj, "overlay"))
> +    {
> +        free (p_sys);
>          return VLC_EGENERIC;
> +    }
>      if (p_sys == NULL)
>          return VLC_ENOMEM;
>  

I'd just move the malloc after this check

-- 
Rafaël Carré



More information about the vlc-devel mailing list