]> git.sesse.net Git - vlc/commitdiff
autodel: fix format copy
authorRémi Denis-Courmont <remi@remlab.net>
Sat, 21 Feb 2015 08:53:14 +0000 (10:53 +0200)
committerRémi Denis-Courmont <remi@remlab.net>
Sat, 21 Feb 2015 08:53:14 +0000 (10:53 +0200)
modules/stream_out/autodel.c

index 3ee560d8173c87afd9c21b4ef9b2fb05b7a0a561..b7c03cd0e787f06615eb7cef5dddaffb935c4d75 100644 (file)
@@ -115,8 +115,11 @@ static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
 {
     sout_stream_sys_t *p_sys = (sout_stream_sys_t *)p_stream->p_sys;
     sout_stream_id_sys_t *p_es = malloc( sizeof(sout_stream_id_sys_t) );
+    if( unlikely(p_es == NULL) )
+        return NULL;
+
+    es_format_Copy( &p_es->fmt, p_fmt );
 
-    p_es->fmt = *p_fmt;
     p_es->id = NULL;
     p_es->i_last = VLC_TS_INVALID;
     p_es->b_error = false;
@@ -128,13 +131,13 @@ static sout_stream_id_sys_t * Add( sout_stream_t *p_stream, es_format_t *p_fmt )
 static void Del( sout_stream_t *p_stream, sout_stream_id_sys_t *p_es )
 {
     sout_stream_sys_t *p_sys = (sout_stream_sys_t *)p_stream->p_sys;
-    sout_stream_id_sys_t *id = p_es->id;
+
+    if( p_es->id != NULL )
+        sout_StreamIdDel( p_stream->p_next, p_es->id );
 
     TAB_REMOVE( p_sys->i_es_num, p_sys->pp_es, p_es );
+    es_format_Clean( &p_es->fmt );
     free( p_es );
-
-    if ( id != NULL )
-        p_stream->p_next->pf_del( p_stream->p_next, id );
 }
 
 static int Send( sout_stream_t *p_stream, sout_stream_id_sys_t *p_es,