[FFmpeg-devel,v1,10/11] avformat/swfdec: fix memleak when inflateInit failed

Submitted by Steven Liu on Oct. 9, 2019, 7:35 a.m.

Details

Message ID 20191009073530.4505-10-lq@chinaffmpeg.org
State New
Headers show

Commit Message

Steven Liu Oct. 9, 2019, 7:35 a.m.
Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/swfdec.c | 2 ++
 1 file changed, 2 insertions(+)

Patch hide | download patch | download mbox

diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c
index 85bd30404e..a9358f09a9 100644
--- a/libavformat/swfdec.c
+++ b/libavformat/swfdec.c
@@ -152,6 +152,8 @@  static int swf_read_header(AVFormatContext *s)
         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);
             return AVERROR(EINVAL);
         }
         pb = swf->zpb;