mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
error_resilience: guess_dc: check malloc failure
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
d2981b8ef1
commit
16e52c86ba
@ -183,6 +183,11 @@ static void guess_dc(MpegEncContext *s, int16_t *dc, int w,
|
|||||||
int16_t (*col )[4] = av_malloc(stride*h*sizeof( int16_t)*4);
|
int16_t (*col )[4] = av_malloc(stride*h*sizeof( int16_t)*4);
|
||||||
uint32_t (*dist)[4] = av_malloc(stride*h*sizeof(uint32_t)*4);
|
uint32_t (*dist)[4] = av_malloc(stride*h*sizeof(uint32_t)*4);
|
||||||
|
|
||||||
|
if(!col || !dist) {
|
||||||
|
av_log(s->avctx, AV_LOG_ERROR, "guess_dc() is out of memory\n");
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
for(b_y=0; b_y<h; b_y++){
|
for(b_y=0; b_y<h; b_y++){
|
||||||
int color= 1024;
|
int color= 1024;
|
||||||
int distance= -1;
|
int distance= -1;
|
||||||
@ -263,6 +268,8 @@ static void guess_dc(MpegEncContext *s, int16_t *dc, int w,
|
|||||||
dc[b_x + b_y * stride] = guess;
|
dc[b_x + b_y * stride] = guess;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fail:
|
||||||
av_freep(&col);
|
av_freep(&col);
|
||||||
av_freep(&dist);
|
av_freep(&dist);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user