From 77670119a1a4a4f5c71c4b8fbe2fedf652c887af Mon Sep 17 00:00:00 2001 From: dan Date: Mon, 6 Nov 2000 14:36:22 +0000 Subject: [PATCH] Optimized some of the previous changes related to order of evaluation. --- wrlib/convert.c | 3 ++- wrlib/jpeg.c | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/wrlib/convert.c b/wrlib/convert.c index 547e2757..2837a914 100644 --- a/wrlib/convert.c +++ b/wrlib/convert.c @@ -614,6 +614,8 @@ image2StandardPseudoColor(RContext *ctx, RImage *image) err = (short*)malloc(3*(image->width+2)*sizeof(short)); nerr = (short*)malloc(3*(image->width+2)*sizeof(short)); if (!err || !nerr) { + if (err) + free(err); if (nerr) free(nerr); RErrorCode = RERR_NOMEMORY; @@ -626,7 +628,6 @@ image2StandardPseudoColor(RContext *ctx, RImage *image) err[x++] = ptr[x1++]; } err[x] = err[x+1] = err[x+2] = 0; - x += 3; /* convert and dither the image to XImage */ for (y=0, ofs=0; yheight; y++) { if (yheight-1) { diff --git a/wrlib/jpeg.c b/wrlib/jpeg.c index 9d94ed2a..e6e05930 100644 --- a/wrlib/jpeg.c +++ b/wrlib/jpeg.c @@ -185,9 +185,9 @@ RLoadJPEG(RContext *context, char *file_name, int index) jpeg_read_scanlines(&cinfo, buffer,(JDIMENSION) 1); bptr = buffer[0]; for (i=0; i