diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-09-20 12:07:19 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-09-23 17:09:01 +0200 |
commit | 28dc0c20cc51346ba7891a324b35e0ef6295c9dd (patch) | |
tree | f15adb699531aa11328925587bf15f6b3e7e6a21 /libavformat/swfdec.c | |
parent | 184fc42b46cb6068af2735d4d888b3254c2db652 (diff) | |
download | ffmpeg-28dc0c20cc51346ba7891a324b35e0ef6295c9dd.tar.gz |
avformat/swfdec: Fix memleaks on error
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'libavformat/swfdec.c')
-rw-r--r-- | libavformat/swfdec.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c index 7ca8460420..91424623fe 100644 --- a/libavformat/swfdec.c +++ b/libavformat/swfdec.c @@ -158,13 +158,18 @@ static int swf_read_header(AVFormatContext *s) swf->zbuf_out = av_malloc(ZBUF_SIZE); swf->zpb = avio_alloc_context(swf->zbuf_out, ZBUF_SIZE, 0, s, zlib_refill, NULL, NULL); - if (!swf->zbuf_in || !swf->zbuf_out || !swf->zpb) + if (!swf->zbuf_in || !swf->zbuf_out || !swf->zpb) { + av_freep(&swf->zbuf_in); + av_freep(&swf->zbuf_out); + avio_context_free(&swf->zpb); return AVERROR(ENOMEM); + } swf->zpb->seekable = 0; if (inflateInit(&swf->zstream) != Z_OK) { av_log(s, AV_LOG_ERROR, "Unable to init zlib context\n"); av_freep(&swf->zbuf_in); av_freep(&swf->zbuf_out); + avio_context_free(&swf->zpb); return AVERROR(EINVAL); } pb = swf->zpb; |