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

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


vlc | branch: master | Pierre Ynard <linkfanel at yahoo.fr> | Sun Nov  4 00:09:08 2012 +0100| [50fe8e1180d012caf19d421229143344d4242405] | committer: Pierre Ynard

avformat: fix use-after-free in error path

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

 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 7ca9769..da93c2f 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -224,15 +224,16 @@ int OpenDemux( vlc_object_t *p_this )
     p_sys->ic->pb->seekable = b_can_seek ? AVIO_SEEKABLE_NORMAL : 0;
     error = avformat_open_input(&p_sys->ic, psz_url, p_sys->fmt, NULL);
 
-    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 );
 
 #if LIBAVFORMAT_VERSION_INT >= ((53<<16)+(26<<8)+0)
     char *psz_opts = var_InheritString( p_demux, "avformat-options" );



More information about the vlc-commits mailing list