[vlc-commits] avformat: fix use-after-free in error path

Pierre Ynard git at videolan.org
Sun Nov 4 00:17:00 CET 2012


vlc/vlc-2.0 | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sun Nov  4 00:09:08 2012 +0100| [96158ea0d8a5f59ee084f92b73cef200f1289b6a] | committer: Pierre Ynard

avformat: fix use-after-free in error path
(cherry picked from commit 50fe8e1180d012caf19d421229143344d4242405)

Signed-off-by: Pierre Ynard <linkfanel at yahoo.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.0.git/?a=commit;h=96158ea0d8a5f59ee084f92b73cef200f1289b6a
---

 modules/demux/avformat/demux.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/modules/demux/avformat/demux.c b/modules/demux/avformat/demux.c
index ada3849..867a924 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -241,15 +241,16 @@ int OpenDemux( vlc_object_t *p_this )
     error = av_open_input_stream(&p_sys->ic, &p_sys->io, psz_url, p_sys->fmt, NULL);
 #endif
 
-    free( psz_url );
     if( error < 0 )
     {
         errno = AVUNERROR(error);
         msg_Err( p_demux, "Could not open %s: %m", psz_url );
         p_sys->ic = NULL;
+        free( psz_url );
         CloseDemux( p_this );
         return VLC_EGENERIC;
     }
+    free( psz_url );
 
     vlc_avcodec_lock(); /* avformat calls avcodec behind our back!!! */
 #if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(26<<8)+0)



More information about the vlc-commits mailing list