*
* Sun Raster image file routines for the Common UNIX Printing System (CUPS).
*
- * Copyright 2007 by Apple Inc.
+ * Copyright 2007-2008 by Apple Inc.
* Copyright 1993-2007 by Easy Software Products.
*
* These coded instructions, statements, and computer programs are the
in = malloc(img->xsize * 3 + 1);
}
- bpp = cupsImageGetDepth(img);
- out = malloc(img->xsize * bpp);
- scanline = malloc(scanwidth);
+ if (!in)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ return (1);
+ }
+
+ bpp = cupsImageGetDepth(img);
+
+ if ((out = malloc(img->xsize * bpp)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ free(in);
+ return (1);
+ }
+
+ if ((scanline = malloc(scanwidth)) == NULL)
+ {
+ fputs("DEBUG: Unable to allocate memory!\n", stderr);
+ fclose(fp);
+ free(in);
+ free(out);
+ return (1);
+ }
+
run_count = 0;
run_value = 0;