]> git.ipfire.org Git - thirdparty/cups.git/blobdiff - scheduler/banners.c
Merge changes from CUPS 1.4svn-r7696.
[thirdparty/cups.git] / scheduler / banners.c
index d83540c873a76cd7e338a77d190d3b88fd660cb7..ef73d2e7cf5859b722544a28e9776df889ff06f3 100644 (file)
@@ -1,25 +1,16 @@
 /*
- * "$Id: banners.c 5305 2006-03-18 03:05:12Z mike $"
+ * "$Id: banners.c 7221 2008-01-16 22:20:08Z mike $"
  *
  *   Banner routines for the Common UNIX Printing System (CUPS).
  *
+ *   Copyright 2007-2008 by Apple Inc.
  *   Copyright 1997-2006 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/".
  *
  * Contents:
  *
@@ -156,8 +147,8 @@ add_banner(const char *name,                /* I - Name of banner */
   if ((filetype = mimeFileType(MimeDatabase, filename, NULL, NULL)) == NULL)
   {
     cupsdLogMessage(CUPSD_LOG_WARN,
-                    "add_banner: Banner \"%s\" (\"%s\") is of an unknown file type - skipping!",
-                    name, filename);
+                    "add_banner: Banner \"%s\" (\"%s\") is of an unknown file "
+                   "type - skipping!", name, filename);
     return;
   }
 
@@ -165,13 +156,27 @@ add_banner(const char *name,              /* I - Name of banner */
   * Allocate memory...
   */
 
-  temp = calloc(1, sizeof(cupsd_banner_t));
+  if ((temp = calloc(1, sizeof(cupsd_banner_t))) == NULL)
+  {
+    cupsdLogMessage(CUPSD_LOG_WARN,
+                    "add_banner: Unable to allocate memory for banner \"%s\" - "
+                   "skipping!", name);
+    return;
+  }
 
  /*
   * Copy the new banner data over...
   */
 
-  temp->name     = strdup(name);
+  if ((temp->name = strdup(name)) == NULL)
+  {
+    cupsdLogMessage(CUPSD_LOG_WARN,
+                    "add_banner: Unable to allocate memory for banner \"%s\" - "
+                   "skipping!", name);
+    free(temp);
+    return;
+  }
+
   temp->filetype = filetype;
 
   cupsArrayAdd(Banners, temp);
@@ -195,7 +200,7 @@ compare_banners(
  * 'free_banners()' - Free all banners.
  */
 
-void
+static void
 free_banners(void)
 {
   cupsd_banner_t       *temp;          /* Current banner */
@@ -215,5 +220,5 @@ free_banners(void)
 
 
 /*
- * End of "$Id: banners.c 5305 2006-03-18 03:05:12Z mike $".
+ * End of "$Id: banners.c 7221 2008-01-16 22:20:08Z mike $".
  */