From: DRC Date: Fri, 25 Feb 2011 01:14:46 +0000 (+0000) Subject: Only access TJBUFSIZEYUV symbol if YUV encoding is enabled, and add 1 to the buffer... X-Git-Tag: 1.1.0~7 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=94476c648beca6d50393ad1750c7f1a007afd0c0;p=libjpeg-turbo Only access TJBUFSIZEYUV symbol if YUV encoding is enabled, and add 1 to the buffer size; This allows jpgtest to be used to benchmark the old TurboJPEG/IPP libraries. git-svn-id: svn+ssh://svn.code.sf.net/p/libjpeg-turbo/code/branches/1.1.x@446 632fc199-4ca6-4c93-a231-07263d6284db --- diff --git a/jpgtest.c b/jpgtest.c index e514733..80ac42e 100644 --- a/jpgtest.c +++ b/jpgtest.c @@ -79,10 +79,9 @@ void dotest(unsigned char *srcbuf, int w, int h, int pf, int bu, flags |= _flags[pf]; if(bu) flags |= TJ_BOTTOMUP; - if(yuv==YUVENCODE) flags |= TJ_YUV; - yuvsize=TJBUFSIZEYUV(w, h, jpegsub); - if((rgbbuf=(unsigned char *)malloc(max(yuvsize, pitch*h))) == NULL) + if(yuv==YUVENCODE) yuvsize=TJBUFSIZEYUV(w, h, jpegsub); + if((rgbbuf=(unsigned char *)malloc(max(yuvsize, pitch*h+1))) == NULL) _throwunix("allocating image buffer"); if(!quiet)