[vlc-commits] avformat: fix memory leak

Hannes Domani git at videolan.org
Thu Aug 27 18:49:59 CEST 2015


vlc | branch: master | Hannes Domani <ssbssa at yahoo.de> | Thu Aug 27 16:18:22 2015 +0200| [97020e0c02ee7b0e049bf6cfdf4574487948f84b] | committer: Jean-Baptiste Kempf

avformat: fix memory leak

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 625375e..823d9f9 100644
--- a/modules/demux/avformat/demux.c
+++ b/modules/demux/avformat/demux.c
@@ -270,7 +270,7 @@ int OpenDemux( vlc_object_t *p_this )
     p_sys->io_buffer = xmalloc( p_sys->io_buffer_size );
 
     p_sys->ic = avformat_alloc_context();
-    p_sys->ic->pb = avio_alloc_context( p_sys->io_buffer,
+    AVIOContext *pb = p_sys->ic->pb = avio_alloc_context( p_sys->io_buffer,
         p_sys->io_buffer_size, 0, p_demux, IORead, NULL, IOSeek );
     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);
@@ -279,6 +279,7 @@ int OpenDemux( vlc_object_t *p_this )
     {
         msg_Err( p_demux, "Could not open %s: %s", psz_url,
                  vlc_strerror_c(AVUNERROR(error)) );
+        av_free( pb );
         p_sys->ic = NULL;
         free( psz_url );
         CloseDemux( p_this );



More information about the vlc-commits mailing list