* 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
* Set graphics mode...
*/
- if (ppd->model_number == 2)
+ if (ppd && ppd->model_number == 2)
{
/*
* Figure out the number of color planes...
* 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;