aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/iff.c
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2019-10-09 11:50:49 +0800
committerSteven Liu <lq@chinaffmpeg.org>2019-10-10 09:54:48 +0800
commit9f0b9ae8bd84b45dc8bc7bcb96607c2948d546d7 (patch)
treef97dd5ec3ce42f01d14d7903c749b46724962992 /libavformat/iff.c
parent6f84c1e9078b2133f3cb75d76f089196a7df96a9 (diff)
downloadffmpeg-9f0b9ae8bd84b45dc8bc7bcb96607c2948d546d7.tar.gz
avformat/iff: fix memleak when get st->codecpar->extradata failed in iff_read_header
Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavformat/iff.c')
-rw-r--r--libavformat/iff.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavformat/iff.c b/libavformat/iff.c
index f4d806b7b8..2a3729f97e 100644
--- a/libavformat/iff.c
+++ b/libavformat/iff.c
@@ -529,8 +529,11 @@ static int iff_read_header(AVFormatContext *s)
st->codecpar->extradata = av_malloc(data_size + IFF_EXTRA_VIDEO_SIZE + AV_INPUT_BUFFER_PADDING_SIZE);
if (!st->codecpar->extradata)
return AVERROR(ENOMEM);
- if (avio_read(pb, st->codecpar->extradata + IFF_EXTRA_VIDEO_SIZE, data_size) < 0)
+ if (avio_read(pb, st->codecpar->extradata + IFF_EXTRA_VIDEO_SIZE, data_size) < 0) {
+ av_freep(&st->codecpar->extradata);
+ st->codecpar->extradata_size = 0;
return AVERROR(EIO);
+ }
break;
case ID_BMHD: