[vlc-commits] commit: Fix a crash in live555 demuxer on close. ( Sébastien Escudier )

git at videolan.org git at videolan.org
Fri Sep 24 10:06:45 CEST 2010


vlc/vlc-1.1 | branch: master | Sébastien Escudier <sebastien-devel at celeos.eu> | Tue Jun 22 15:25:37 2010 +0200| [68adfe3edc0e5b368798057a116d3685be0fc418] | committer: Sébastien Escudier 

Fix a crash in live555 demuxer on close.
We must first close the stream before deleting the tracks, because tracks can be used in StreamClose callback.
This crash could only happen in recents version of live555 library.

> http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=68adfe3edc0e5b368798057a116d3685be0fc418
---

 modules/demux/live555.cpp |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/modules/demux/live555.cpp b/modules/demux/live555.cpp
index 69d9d95..b173dd5 100644
--- a/modules/demux/live555.cpp
+++ b/modules/demux/live555.cpp
@@ -427,9 +427,13 @@ static void Close( vlc_object_t *p_this )
 {
     demux_t *p_demux = (demux_t*)p_this;
     demux_sys_t *p_sys = p_demux->p_sys;
-    int i;
 
-    for( i = 0; i < p_sys->i_track; i++ )
+    if( p_sys->rtsp && p_sys->ms ) p_sys->rtsp->teardownMediaSession( *p_sys->ms );
+    if( p_sys->ms ) Medium::close( p_sys->ms );
+    if( p_sys->rtsp ) RTSPClient::close( p_sys->rtsp );
+    if( p_sys->env ) p_sys->env->reclaim();
+
+    for( int i = 0; i < p_sys->i_track; i++ )
     {
         live_track_t *tk = p_sys->track[i];
 
@@ -441,16 +445,12 @@ static void Close( vlc_object_t *p_this )
 
     if( p_sys->i_track ) free( p_sys->track );
     if( p_sys->p_out_asf ) stream_Delete( p_sys->p_out_asf );
-    if( p_sys->rtsp && p_sys->ms ) p_sys->rtsp->teardownMediaSession( *p_sys->ms );
     if( p_sys->p_timeout )
     {
         vlc_cancel( p_sys->p_timeout->handle );
         vlc_join( p_sys->p_timeout->handle, NULL );
         free( p_sys->p_timeout );
     }
-    if( p_sys->ms ) Medium::close( p_sys->ms );
-    if( p_sys->rtsp ) RTSPClient::close( p_sys->rtsp );
-    if( p_sys->env ) p_sys->env->reclaim();
     delete p_sys->scheduler;
     free( p_sys->p_sdp );
     free( p_sys->psz_path );



More information about the vlc-commits mailing list