summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <[email protected]>2020-09-20 12:07:19 +0200
committerAndreas Rheinhardt <[email protected]>2021-02-27 07:20:58 +0100
commit5db6f6672f12c5e367e5b5cdf7f3107088f0e216 (patch)
tree7273758942003feefdd48853df6f8bd1eca852e6
parent753c0afe72a7ba634d5d58e5add67fbda1fbb427 (diff)
avformat/swfdec: Fix memleaks on error
Signed-off-by: Andreas Rheinhardt <[email protected]> (cherry picked from commit 28dc0c20cc51346ba7891a324b35e0ef6295c9dd)
-rw-r--r--libavformat/swfdec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c
index 9a0b27bd8c..331a2e7c8b 100644
--- a/libavformat/swfdec.c
+++ b/libavformat/swfdec.c
@@ -147,13 +147,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;