diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-12-19 05:37:11 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-12-19 05:37:26 +0100 |
commit | c89751aa218c22e2d0febcafba4b01c533b8836e (patch) | |
tree | 9dc729cab5dd91a1277e6bc89295e6ff967d412f | |
parent | 8ccfafa7b41b8239cfbbaa5dfd8eea8a300c64be (diff) | |
parent | 210461c0a83a5625560fa1d92229200dc7fb869b (diff) | |
download | ffmpeg-c89751aa218c22e2d0febcafba4b01c533b8836e.tar.gz |
Merge commit '210461c0a83a5625560fa1d92229200dc7fb869b'
* commit '210461c0a83a5625560fa1d92229200dc7fb869b':
imgconvert: check memory allocations and propagate errors
Merged-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/imgconvert.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libavcodec/imgconvert.c b/libavcodec/imgconvert.c index 158bc739a1..8cb609946a 100644 --- a/libavcodec/imgconvert.c +++ b/libavcodec/imgconvert.c @@ -378,13 +378,15 @@ static void deinterlace_bottom_field(uint8_t *dst, int dst_wrap, deinterlace_line(dst,src_m2,src_m1,src_0,src_0,src_0,width); } -static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, - int width, int height) +static int deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, + int width, int height) { uint8_t *src_m1, *src_0, *src_p1, *src_p2; int y; uint8_t *buf; buf = av_malloc(width); + if (!buf) + return AVERROR(ENOMEM); src_m1 = src1; memcpy(buf,src_m1,width); @@ -401,12 +403,13 @@ static void deinterlace_bottom_field_inplace(uint8_t *src1, int src_wrap, /* do last line */ deinterlace_line_inplace(buf,src_m1,src_0,src_0,src_0,width); av_free(buf); + return 0; } int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, enum AVPixelFormat pix_fmt, int width, int height) { - int i; + int i, ret; if (pix_fmt != AV_PIX_FMT_YUV420P && pix_fmt != AV_PIX_FMT_YUVJ420P && @@ -442,8 +445,11 @@ int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, } } if (src == dst) { - deinterlace_bottom_field_inplace(dst->data[i], dst->linesize[i], - width, height); + ret = deinterlace_bottom_field_inplace(dst->data[i], + dst->linesize[i], + width, height); + if (ret < 0) + return ret; } else { deinterlace_bottom_field(dst->data[i],dst->linesize[i], src->data[i], src->linesize[i], |