Browse Source

avcodec/snow: Fix av_malloc* failure checks

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n2.6
Michael Niedermayer 11 years ago
parent
commit
56c7e1059a
1 changed files with 11 additions and 4 deletions
  1. +11
    -4
      libavcodec/snow.c

+ 11
- 4
libavcodec/snow.c View File

@@ -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++){


Loading…
Cancel
Save