Skip to content

Commit c72fca5

Browse files
committed
avcodec/vc1dec: Fix memleak upon allocation error
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> (cherry picked from commit 98060a1)
1 parent b0997b8 commit c72fca5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

libavcodec/vc1dec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,7 +384,7 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v)
384384
if (s->avctx->codec_id == AV_CODEC_ID_WMV3IMAGE || s->avctx->codec_id == AV_CODEC_ID_VC1IMAGE) {
385385
for (i = 0; i < 4; i++)
386386
if (!(v->sr_rows[i >> 1][i & 1] = av_malloc(v->output_width)))
387-
return AVERROR(ENOMEM);
387+
goto error;
388388
}
389389

390390
ret = ff_intrax8_common_init(s->avctx, &v->x8, &s->idsp,

0 commit comments

Comments
 (0)