[FFmpeg-cvslog] avformat/cache: Fix memleak of tree entries

Michael Niedermayer git at videolan.org
Wed Apr 27 05:42:55 CEST 2016


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Wed Mar  2 14:09:23 2016 +0100| [69942c4f6dfeb55cbaf88f346e946e39d33b8ccf] | committer: Michael Niedermayer

avformat/cache: Fix memleak of tree entries

Found-by: jamrial

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 554f6e930ce05a4c5449efcaae36bdafe2d9de74)

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=69942c4f6dfeb55cbaf88f346e946e39d33b8ccf
---

 libavformat/cache.c |    7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavformat/cache.c b/libavformat/cache.c
index d3d12bb..7cb6c22 100644
--- a/libavformat/cache.c
+++ b/libavformat/cache.c
@@ -282,6 +282,12 @@ resolve_eof:
     return ret;
 }
 
+static int enu_free(void *opaque, void *elem)
+{
+    av_free(elem);
+    return 0;
+}
+
 static int cache_close(URLContext *h)
 {
     Context *c= h->priv_data;
@@ -291,6 +297,7 @@ static int cache_close(URLContext *h)
 
     close(c->fd);
     ffurl_close(c->inner);
+    av_tree_enumerate(c->root, NULL, NULL, enu_free);
     av_tree_destroy(c->root);
 
     return 0;



More information about the ffmpeg-cvslog mailing list