diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-01-12 23:15:32 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-01-12 23:46:50 +0100 |
commit | 56c7e1059ab993da68caa3847372f3fb5e010dc4 (patch) | |
tree | 6681ae6036388c71ea90b52c037ccf6bf6fed74b | |
parent | 13871a95d0e4af15b771040254079da908a34d6b (diff) | |
download | ffmpeg-56c7e1059ab993da68caa3847372f3fb5e010dc4.tar.gz |
avcodec/snow: Fix av_malloc* failure checks
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/snow.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/libavcodec/snow.c b/libavcodec/snow.c index d5a620ba68..c4f7004266 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -594,11 +594,18 @@ static int halfpel_interpol(SnowContext *s, uint8_t *halfpel[4][4], AVFrame *fra int ls= frame->linesize[p]; uint8_t *src= frame->data[p]; - halfpel[1][p] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls); - halfpel[2][p] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls); - halfpel[3][p] = (uint8_t*) av_malloc_array(ls, (h + 2 * EDGE_WIDTH)) + EDGE_WIDTH * (1 + ls); - if (!halfpel[1][p] || !halfpel[2][p] || !halfpel[3][p]) + halfpel[1][p] = av_malloc_array(ls, (h + 2 * EDGE_WIDTH)); + halfpel[2][p] = av_malloc_array(ls, (h + 2 * EDGE_WIDTH)); + halfpel[3][p] = av_malloc_array(ls, (h + 2 * EDGE_WIDTH)); + if (!halfpel[1][p] || !halfpel[2][p] || !halfpel[3][p]) { + av_freep(&halfpel[1][p]); + av_freep(&halfpel[2][p]); + av_freep(&halfpel[3][p]); return AVERROR(ENOMEM); + } + halfpel[1][p] += EDGE_WIDTH * (1 + ls); + halfpel[2][p] += EDGE_WIDTH * (1 + ls); + halfpel[3][p] += EDGE_WIDTH * (1 + ls); halfpel[0][p]= src; for(y=0; y<h; y++){ |