[FFmpeg-cvslog] mov: fix leaking memory with multiple drefs.

Dale Curtis git at videolan.org
Sun Apr 15 23:36:04 CEST 2012


ffmpeg | branch: master | Dale Curtis <dalecurtis at chromium.org> | Thu Apr 12 17:56:57 2012 -0700| [4ebd422c04849a21a6bb2128a715979e8067e6a6] | committer: Luca Barbato

mov: fix leaking memory with multiple drefs.

Instead of allocating over the original, free first. MOVStreamContext
is zero initialized so no double free will occur. Same style as other
fixes for the same problem in this file.

Signed-off-by: Dale Curtis <dalecurtis at chromium.org>
Signed-off-by: Luca Barbato <lu_zero at gentoo.org>

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

 libavformat/mov.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 046c030..5787f1a 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -387,6 +387,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     entries = avio_rb32(pb);
     if (entries >= UINT_MAX / sizeof(*sc->drefs))
         return AVERROR_INVALIDDATA;
+    av_free(sc->drefs);
     sc->drefs = av_mallocz(entries * sizeof(*sc->drefs));
     if (!sc->drefs)
         return AVERROR(ENOMEM);



More information about the ffmpeg-cvslog mailing list