[vlc-devel] [PATCH] avformat: check malloc() result

Zhao Zhili wantlamy at gmail.com
Sat Feb 27 07:21:43 CET 2016


It's just an int, it is very unlikely to happen.

On Sat, Feb 27, 2016 at 1:21 AM, Hannes Domani <ssbssa at yahoo.de> wrote:

> ---
>  modules/demux/avformat/mux.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
> index bf53abd..b5c86a5 100644
> --- a/modules/demux/avformat/mux.c
> +++ b/modules/demux/avformat/mux.c
> @@ -210,6 +210,9 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t
> *p_input )
>      }
>
>      p_input->p_sys = malloc( sizeof( int ) );
> +    if( unlikely(p_input->p_sys == NULL) )
> +        return VLC_ENOMEM;
> +
>      *((int *)p_input->p_sys) = p_sys->oc->nb_streams;
>
>      stream = avformat_new_stream( p_sys->oc, NULL);
> --
> 2.7.1
>
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20160227/7bf80882/attachment.html>


More information about the vlc-devel mailing list