]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/vc1dec: Fix memleak upon allocation error
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Wed, 7 Apr 2021 23:49:53 +0000 (01:49 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Thu, 8 Apr 2021 08:51:59 +0000 (10:51 +0200)
ff_vc1_decode_init_alloc_tables() had one error path that forgot to free
already allocated buffers; these would then be overwritten on the next
allocation attempt (or they would just not be freed in case this
happened during init, as the decoders for which it is used do not have
the FF_CODEC_CAP_INIT_CLEANUP set).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
libavcodec/vc1dec.c

index b702b76060866d359bcc63e5fdcfeb9ad109bf81..ea93e115884ed17649488e20ded44c96ea6d88aa 100644 (file)
@@ -384,7 +384,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
     if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == AV_CODEC_ID_VC1IMAGE) {
         for (i = 0; i < 4; i++)
             if (!(v->sr_rows[i >> 1][i & 1] = av_malloc(v->output_width)))
-                return AVERROR(ENOMEM);
+                goto error;
     }
 
     ret = ff_intrax8_common_init(s->avctx, &v->x8, &s->idsp,