diff --git a/libavformat/mov.c b/libavformat/mov.c index 6490022b1d..e11c9f4457 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2886,6 +2886,7 @@ static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom) for (i = 0; i < entries && !pb->eof_reached; i++) { sc->sample_sizes[i] = get_bits_long(&gb, field_size); if (sc->sample_sizes[i] < 0) { + av_free(buf); av_log(c->fc, AV_LOG_ERROR, "Invalid sample size %d\n", sc->sample_sizes[i]); return AVERROR_INVALIDDATA; }