]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - filter/image-pix.c
Import CUPS 1.4svn-r7226.
[thirdparty/cups.git] / filter / image-pix.c
index e72fdff14871ba78bf35356e14ccf37b371a8932..e5e20f463e15e1d658361d1c30a8ba0b2bd14537 100644 (file)
@@ -3,7 +3,7 @@
  *
  *   Alias PIX image 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
@@ -95,9 +95,22 @@ _cupsImageReadPIX(
 
   cupsImageSetMaxTiles(img, 0);
 
-  in  = malloc(img->xsize * (depth / 8));
   bpp = cupsImageGetDepth(img);
-  out = malloc(img->xsize * bpp);
+
+  if ((in = malloc(img->xsize * (depth / 8))) == NULL)
+  {
+    fputs("DEBUG: Unable to allocate memory!\n", stderr);
+    fclose(fp);
+    return (1);
+  }
+
+  if ((out = malloc(img->xsize * bpp)) == NULL)
+  {
+    fputs("DEBUG: Unable to allocate memory!\n", stderr);
+    fclose(fp);
+    free(in);
+    return (1);
+  }
 
  /*
   * Read the image data...