diff mbox series

[FFmpeg-devel] avcodec/vc1dec: Fix memleak upon allocation error

Message ID HE1PR0301MB2154CDD06264E63B155BA7898F759@HE1PR0301MB2154.eurprd03.prod.outlook.com
State Accepted
Commit 98060a198ef0bd213d0d0b029f8955fcd3be93d2
Headers show
Series [FFmpeg-devel] avcodec/vc1dec: Fix memleak upon allocation error | expand


Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt April 7, 2021, 11:56 p.m. UTC
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

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Will apply this soon as it is quite easy and straightforward.

 libavcodec/vc1dec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series


diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c
index b702b76060..ea93e11588 100644
--- a/libavcodec/vc1dec.c
+++ b/libavcodec/vc1dec.c
@@ -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,