[FFmpeg-devel] [PATCH 2/2] cafdec: free extradata before allocating it
Andreas Cadhalpun
andreas.cadhalpun at googlemail.com
Wed May 13 00:25:56 CEST 2015
This fixes a memleak if read_kuki_chunk is executed more than once.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
---
libavformat/cafdec.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c
index abbb353..cc6ed0c 100644
--- a/libavformat/cafdec.c
+++ b/libavformat/cafdec.c
@@ -134,6 +134,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
return AVERROR_INVALIDDATA;
}
+ av_freep(&st->codec->extradata);
if (ff_alloc_extradata(st->codec, ALAC_HEADER))
return AVERROR(ENOMEM);
@@ -166,6 +167,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size)
avio_skip(pb, size - ALAC_NEW_KUKI);
}
} else {
+ av_freep(&st->codec->extradata);
if (ff_get_extradata(st->codec, pb, size) < 0)
return AVERROR(ENOMEM);
}
--
2.1.4
More information about the ffmpeg-devel
mailing list