diff options
author | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-05-13 00:22:03 +0200 |
---|---|---|
committer | Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com> | 2015-05-13 20:11:37 +0200 |
commit | cb7c4f73e5e3debe2646279eaa7cfb493573118b (patch) | |
tree | 4a0a9a5d379c24f9c1fd51402bbacc9d84ed6e49 | |
parent | a3ede6b742f37d511253ab4c2fd98c13203f1cd3 (diff) | |
download | ffmpeg-cb7c4f73e5e3debe2646279eaa7cfb493573118b.tar.gz |
cafdec: free extradata before allocating it
This fixes a memleak if read_kuki_chunk is executed more than once.
Reviewed-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
-rw-r--r-- | libavformat/cafdec.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index abbb3538d7..cc6ed0ce9f 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); } |