diff options
author | Paul B Mahol <onemda@gmail.com> | 2013-09-09 14:48:37 +0000 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2013-09-10 15:44:10 +0000 |
commit | 942babd87f18372c2b533b246a083250640466b8 (patch) | |
tree | fa5d33396a2bd44fb5f8ec5d09ba50dfce69a101 /libavcodec | |
parent | 7883827cb7f3f8c1f08d4d71611f99a3025f4a96 (diff) | |
download | ffmpeg-942babd87f18372c2b533b246a083250640466b8.tar.gz |
avcodec/vp56: use av_reallocp_array() and check if allocation failed
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/vp56.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/libavcodec/vp56.c b/libavcodec/vp56.c index 38f0e08f38..25801ea6c0 100644 --- a/libavcodec/vp56.c +++ b/libavcodec/vp56.c @@ -475,13 +475,15 @@ static int vp56_size_changed(VP56Context *s) return -1; } - s->above_blocks = av_realloc(s->above_blocks, - (4*s->mb_width+6) * sizeof(*s->above_blocks)); - s->macroblocks = av_realloc(s->macroblocks, - s->mb_width*s->mb_height*sizeof(*s->macroblocks)); + av_reallocp_array(&s->above_blocks, 4*s->mb_width+6, + sizeof(*s->above_blocks)); + av_reallocp_array(&s->macroblocks, s->mb_width*s->mb_height, + sizeof(*s->macroblocks)); av_free(s->edge_emu_buffer_alloc); s->edge_emu_buffer_alloc = av_malloc(16*stride); s->edge_emu_buffer = s->edge_emu_buffer_alloc; + if (!s->above_blocks || !s->macroblocks || !s->edge_emu_buffer_alloc) + return AVERROR(ENOMEM); if (s->flip < 0) s->edge_emu_buffer += 15 * stride; |