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

Hannes Domani ssbssa at yahoo.de
Fri Feb 26 17:49:18 CET 2016


---
 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 ) );
+    *((int *)p_input->p_sys) = p_sys->oc->nb_streams;
+
     stream = avformat_new_stream( p_sys->oc, NULL);
     if( !stream )
     {
-- 
2.7.1



More information about the vlc-devel mailing list