]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/jpeglsenc.c
huffyuv: do not decode/encode yuv colorspace with odd width
[ffmpeg] / libavcodec / jpeglsenc.c
index 62a2328a0a3dcda6d68e3832621ea8bfa55baf37..4b8bedb9f47b31430fbebea4e6b74fad190e6e31 100644 (file)
@@ -250,9 +250,8 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
     else
         comps = 3;
 
-    if ((ret = ff_alloc_packet(pkt, avctx->width*avctx->height*comps*4 +
+    if ((ret = ff_alloc_packet2(avctx, pkt, avctx->width*avctx->height*comps*4 +
                                     FF_MIN_BUFFER_SIZE)) < 0) {
-        av_log(avctx, AV_LOG_ERROR, "Error getting output packet.\n");
         return ret;
     }
 
@@ -295,7 +294,9 @@ static int encode_picture_ls(AVCodecContext *avctx, AVPacket *pkt,
 
     ls_store_lse(state, &pb);
 
-    zero = av_mallocz(p->linesize[0]);
+    zero = av_mallocz(FFABS(p->linesize[0]));
+    if (!zero)
+        return AVERROR(ENOMEM);
     last = zero;
     cur = p->data[0];
     if(avctx->pix_fmt == PIX_FMT_GRAY8){