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);