summaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2019-10-10 10:07:56 +0800
committerSteven Liu <lq@chinaffmpeg.org>2019-10-28 14:26:22 +0800
commit68f623d64451a6ee8c81b6071ec68d6097c0f213 (patch)
treeb0d239699f669274cff924d9ed11a5f6eeae38f3 /libavformat
parent70c6e8406984d435543fe172dae481c8de491619 (diff)
downloadffmpeg-streaming-68f623d64451a6ee8c81b6071ec68d6097c0f213.zip
ffmpeg-streaming-68f623d64451a6ee8c81b6071ec68d6097c0f213.tar.gz
avformat/wc3movie: fix memleak when read content size not equvipe input size
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/wc3movie.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c
index 27f5eb1..6577007 100644
--- a/libavformat/wc3movie.c
+++ b/libavformat/wc3movie.c
@@ -130,8 +130,10 @@ static int wc3_read_header(AVFormatContext *s)
buffer = av_malloc(size+1);
if (!buffer)
return AVERROR(ENOMEM);
- if ((ret = avio_read(pb, buffer, size)) != size)
+ if ((ret = avio_read(pb, buffer, size)) != size) {
+ av_freep(&buffer);
return AVERROR(EIO);
+ }
buffer[size] = 0;
av_dict_set(&s->metadata, "title", buffer,
AV_DICT_DONT_STRDUP_VAL);
OpenPOWER on IntegriCloud