summaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorSteven Liu <lq@chinaffmpeg.org>2019-10-09 11:56:22 +0800
committerSteven Liu <lq@chinaffmpeg.org>2019-10-10 09:54:42 +0800
commit6f84c1e9078b2133f3cb75d76f089196a7df96a9 (patch)
tree5226ce704abe9ca5e8f78a0b2cd8beb63bef3fa5 /libavformat
parentda0c0c7247fbf1596ec768746071d6d2f91d0fb0 (diff)
downloadffmpeg-streaming-6f84c1e9078b2133f3cb75d76f089196a7df96a9.zip
ffmpeg-streaming-6f84c1e9078b2133f3cb75d76f089196a7df96a9.tar.gz
avformat/jvdec: fix memleak when read_header failed
Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/jvdec.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/libavformat/jvdec.c b/libavformat/jvdec.c
index 18c81f0..17ada7b 100644
--- a/libavformat/jvdec.c
+++ b/libavformat/jvdec.c
@@ -113,9 +113,10 @@ static int read_header(AVFormatContext *s)
return AVERROR(ENOMEM);
jv->frames = av_malloc(ast->nb_index_entries * sizeof(JVFrame));
- if (!jv->frames)
+ if (!jv->frames) {
+ av_freep(&ast->index_entries);
return AVERROR(ENOMEM);
-
+ }
offset = 0x68 + ast->nb_index_entries * 16;
for (i = 0; i < ast->nb_index_entries; i++) {
AVIndexEntry *e = ast->index_entries + i;
@@ -137,6 +138,8 @@ static int read_header(AVFormatContext *s)
- jvf->palette_size < 0) {
if (s->error_recognition & AV_EF_EXPLODE) {
read_close(s);
+ av_freep(&jv->frames);
+ av_freep(&ast->index_entries);
return AVERROR_INVALIDDATA;
}
jvf->audio_size =
OpenPOWER on IntegriCloud