[vlc-devel] [PATCH 4/7] avformat: fix memory leak on unhandled ES category

Denis Charmet typx at dinauz.org
Fri Feb 26 18:05:55 CET 2016


Hi,

On 2016-02-26 17:49, Hannes Domani wrote:
> ---
>  modules/demux/avformat/mux.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/modules/demux/avformat/mux.c 
> b/modules/demux/avformat/mux.c
> index da00d3e..bf53abd 100644
> --- a/modules/demux/avformat/mux.c
> +++ b/modules/demux/avformat/mux.c
> @@ -203,15 +203,15 @@ static int AddStream( sout_mux_t *p_mux,
> sout_input_t *p_input )
>          }
>      }
> 
> -    p_input->p_sys = malloc( sizeof( int ) );
> -    *((int *)p_input->p_sys) = p_sys->oc->nb_streams;
> -
>      if( fmt->i_cat != VIDEO_ES && fmt->i_cat != AUDIO_ES)
>      {
>          msg_Warn( p_mux, "Unhandled ES category" );
>          return VLC_EGENERIC;
>      }
> 
> +    p_input->p_sys = malloc( sizeof( int ) );

Please check the malloc result.

> +    *((int *)p_input->p_sys) = p_sys->oc->nb_streams;
> +
>      stream = avformat_new_stream( p_sys->oc, NULL);
>      if( !stream )
>      {

Regards,
-- 
Denis Charmet - TypX
Le mauvais esprit est un art de vivre


More information about the vlc-devel mailing list