[vlc-commits] autodel: fix format copy

Rémi Denis-Courmont git at videolan.org
Sat Feb 21 11:24:21 CET 2015


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Feb 21 10:53:14 2015 +0200| [77befcece5c552996e9337e5ea900afab48d9718] | committer: Rémi Denis-Courmont

autodel: fix format copy

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

 modules/stream_out/autodel.c |   13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/modules/stream_out/autodel.c b/modules/stream_out/autodel.c
index 3ee560d..b7c03cd 100644
--- a/modules/stream_out/autodel.c
+++ b/modules/stream_out/autodel.c
@@ -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,



More information about the vlc-commits mailing list