diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-02-22 02:40:16 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-02-22 02:40:16 +0100 |
commit | 21518f5a0a6b644d1dedda5650c15bc3df62a567 (patch) | |
tree | b01c20dd5c905ad9165ddf7477fa63d713905d0a /libavcodec/libvpxenc.c | |
parent | 67d4d5f5db060fece8cc8e925f18f0a1c48813c6 (diff) | |
download | ffmpeg-streaming-21518f5a0a6b644d1dedda5650c15bc3df62a567.zip ffmpeg-streaming-21518f5a0a6b644d1dedda5650c15bc3df62a567.tar.gz |
avcodec/libvpxenc: Check for av_malloc() failure
Fixes CID1271045
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/libvpxenc.c')
-rw-r--r-- | libavcodec/libvpxenc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c index 4cb0e21..9ad0c54 100644 --- a/libavcodec/libvpxenc.c +++ b/libavcodec/libvpxenc.c @@ -717,9 +717,14 @@ static int vp8_encode(AVCodecContext *avctx, AVPacket *pkt, rawimg_alpha = &ctx->rawimg_alpha; rawimg_alpha->planes[VPX_PLANE_Y] = frame->data[3]; u_plane = av_malloc(frame->linesize[1] * frame->height); + v_plane = av_malloc(frame->linesize[2] * frame->height); + if (!u_plane || !v_plane) { + av_free(u_plane); + av_free(v_plane); + return AVERROR(ENOMEM); + } memset(u_plane, 0x80, frame->linesize[1] * frame->height); rawimg_alpha->planes[VPX_PLANE_U] = u_plane; - v_plane = av_malloc(frame->linesize[2] * frame->height); memset(v_plane, 0x80, frame->linesize[2] * frame->height); rawimg_alpha->planes[VPX_PLANE_V] = v_plane; rawimg_alpha->stride[VPX_PLANE_Y] = frame->linesize[0]; |