[vlc-commits] avformat mux: check malloc return

Jean-Baptiste Kempf git at videolan.org
Fri Feb 26 18:22:35 CET 2016


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Fri Feb 26 18:22:12 2016 +0100| [6942be9f46c63e4f41b6371cba949bfe16e4a260] | committer: Jean-Baptiste Kempf

avformat mux: check malloc return

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6942be9f46c63e4f41b6371cba949bfe16e4a260
---

 modules/demux/avformat/mux.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/demux/avformat/mux.c b/modules/demux/avformat/mux.c
index bf53abd..75e38f9 100644
--- a/modules/demux/avformat/mux.c
+++ b/modules/demux/avformat/mux.c
@@ -209,9 +209,14 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
         return VLC_EGENERIC;
     }
 
+    /* */
     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);
     if( !stream )
     {



More information about the vlc-commits mailing list