]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - filter/image-sgi.c
Merge changes from CUPS 1.5.1-r9875.
[thirdparty/cups.git] / filter / image-sgi.c
index 8461c3817848431698f14dab5c00d030f814fb2a..39d6f4453fdbd18134d66de96c320ff893747279 100644 (file)
@@ -1,25 +1,16 @@
 /*
- * "$Id: image-sgi.c 6420 2007-03-30 20:00:59Z mike $"
+ * "$Id: image-sgi.c 7223 2008-01-16 23:41:19Z mike $"
  *
- *   SGI image file routines for the Common UNIX Printing System (CUPS).
+ *   SGI image file routines for CUPS.
  *
+ *   Copyright 2007-2011 by Apple Inc.
  *   Copyright 1993-2007 by Easy Software Products.
  *
  *   These coded instructions, statements, and computer programs are the
- *   property of Easy Software Products and are protected by Federal
- *   copyright law.  Distribution and use rights are outlined in the file
- *   "LICENSE.txt" which should have been included with this file.  If this
- *   file is missing or damaged please contact Easy Software Products
- *   at:
- *
- *       Attn: CUPS Licensing Information
- *       Easy Software Products
- *       44141 Airport View Drive, Suite 204
- *       Hollywood, Maryland 20636 USA
- *
- *       Voice: (301) 373-9600
- *       EMail: cups-info@cups.org
- *         WWW: http://www.cups.org
+ *   property of Apple Inc. and are protected by Federal copyright
+ *   law.  Distribution and use rights are outlined in the file "LICENSE.txt"
+ *   which should have been included with this file.  If this file is
+ *   file is missing or damaged, see the license at "http://www.cups.org/".
  *
  *   This file is subject to the Apple OS-Developed Software exception.
  *
@@ -86,7 +77,6 @@ _cupsImageReadSGI(
     fprintf(stderr, "DEBUG: Bad SGI image dimensions %ux%ux%u!\n",
             sgip->xsize, sgip->ysize, sgip->zsize);
     sgiClose(sgip);
-    fclose(fp);
     return (1);
   }
 
@@ -101,10 +91,32 @@ _cupsImageReadSGI(
   cupsImageSetMaxTiles(img, 0);
 
   bpp = cupsImageGetDepth(img);
-  in  = malloc(img->xsize * sgip->zsize);
-  out = malloc(img->xsize * bpp);
 
-  rows[0] = calloc(img->xsize * sgip->zsize, sizeof(unsigned short));
+  if ((in = malloc(img->xsize * sgip->zsize)) == NULL)
+  {
+    fputs("DEBUG: Unable to allocate memory!\n", stderr);
+    sgiClose(sgip);
+    return (1);
+  }
+
+  if ((out = malloc(img->xsize * bpp)) == NULL)
+  {
+    fputs("DEBUG: Unable to allocate memory!\n", stderr);
+    sgiClose(sgip);
+    free(in);
+    return (1);
+  }
+
+  if ((rows[0] = calloc(img->xsize * sgip->zsize,
+                        sizeof(unsigned short))) == NULL)
+  {
+    fputs("DEBUG: Unable to allocate memory!\n", stderr);
+    sgiClose(sgip);
+    free(in);
+    free(out);
+    return (1);
+  }
+
   for (i = 1; i < sgip->zsize; i ++)
     rows[i] = rows[0] + i * img->xsize;
 
@@ -279,5 +291,5 @@ _cupsImageReadSGI(
 
 
 /*
- * End of "$Id: image-sgi.c 6420 2007-03-30 20:00:59Z mike $".
+ * End of "$Id: image-sgi.c 7223 2008-01-16 23:41:19Z mike $".
  */