[vlc-commits] avformat: fix memory leak

Hannes Domani git at videolan.org
Wed Oct 21 18:50:47 CEST 2015


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

avformat: fix memory leak

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
(cherry picked from commit 97020e0c02ee7b0e049bf6cfdf4574487948f84b)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.2.git/?a=commit;h=3d46f2ea44e36a3c78d363c5139c7086c5d42362
---

 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 826b78e..9a1c415 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