diff options
author | Vittorio Giovara <vittorio.giovara@gmail.com> | 2016-02-24 14:40:18 -0500 |
---|---|---|
committer | Vittorio Giovara <vittorio.giovara@gmail.com> | 2016-02-25 15:20:53 -0500 |
commit | 01f0e6a0c9270f1d5bef08459a6f167cf55e0596 (patch) | |
tree | f58580f77016f2690bb0f6f21a9f9c9791dd148b /libavcodec/vc1dec.c | |
parent | f91d94bdfc3f5f83ff0be4d19d10d0a35697386f (diff) | |
download | ffmpeg-01f0e6a0c9270f1d5bef08459a6f167cf55e0596.tar.gz |
vc1dec: Fix leak on error for array allocations
The deinit function in the 'error' section will correctly free
everything.
Diffstat (limited to 'libavcodec/vc1dec.c')
-rw-r--r-- | libavcodec/vc1dec.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index 2ccbbd54a2..9d0f890a02 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -355,8 +355,11 @@ av_cold int ff_vc1_decode_init_alloc_tables(VC1Context *v) ff_intrax8_common_init(&v->x8,s); 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 -1; + for (i = 0; i < 4; i++) { + v->sr_rows[i >> 1][i & 1] = av_malloc(v->output_width); + if (!v->sr_rows[i >> 1][i & 1]) + goto error; + } } if (!v->mv_type_mb_plane || !v->direct_mb_plane || !v->acpred_plane || !v->over_flags_plane || |