1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

avformat/swfdec: Fix memleaks on error

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
(cherry picked from commit 28dc0c20cc)
This commit is contained in:
Andreas Rheinhardt 2020-09-20 12:07:19 +02:00
parent 753c0afe72
commit 5db6f6672f

View File

@ -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;