]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - filter/rastertohp.c
Import CUPS 1.4svn-r7226.
[thirdparty/cups.git] / filter / rastertohp.c
index 2c41a2652dc602b75969d9728c0ac57a7340f32d..f35b58ca7639e8a586681a422a16efa1a6d35f4c 100644 (file)
@@ -4,7 +4,7 @@
  *   Hewlett-Packard Page Control Language filter 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
@@ -277,7 +277,7 @@ StartPage(ppd_file_t         *ppd,  /* I - PPD file */
   * Set graphics mode...
   */
 
-  if (ppd->model_number == 2)
+  if (ppd && ppd->model_number == 2)
   {
    /*
     * Figure out the number of color planes...
@@ -382,7 +382,12 @@ StartPage(ppd_file_t         *ppd, /* I - PPD file */
   * Allocate memory for a line of graphics...
   */
 
-  Planes[0] = malloc(header->cupsBytesPerLine);
+  if ((Planes[0] = malloc(header->cupsBytesPerLine)) == NULL)
+  {
+    fputs("ERROR: Unable to allocate memory!\n", stderr);
+    exit(1);
+  }
+
   for (plane = 1; plane < NumPlanes; plane ++)
     Planes[plane] = Planes[0] + plane * header->cupsBytesPerLine / NumPlanes;