summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorDale Curtis <dalecurtis@chromium.org>2012-04-12 17:56:57 -0700
committerLuca Barbato <lu_zero@gentoo.org>2012-04-14 19:41:52 -0700
commit4ebd422c04849a21a6bb2128a715979e8067e6a6 (patch)
tree22c44fda727ce3f350ef4257fe25ce7adfcd69d5 /libavformat/mov.c
parent7f77e9041a79fd05ed872ff9eeb06f109d30acb7 (diff)
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@chromium.org> Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 046c030bcf..5787f1aeb0 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);