]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/libvpxenc.c
Merge commit '82b6e451161f19ab90bfb9565b710021caf5dcbd'
[ffmpeg] / libavcodec / libvpxenc.c
index 4cb0e21458aeb6edad71ddcf9271ecaeff7581a1..9ad0c548b9ebe6f0d985e05ccd0ddb5bb99d7f5b 100644 (file)
@@ -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];