]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix Coverity-discovered issues.
authorMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 13 Sep 2023 17:47:55 +0000 (13:47 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 13 Sep 2023 17:47:55 +0000 (13:47 -0400)
cups/raster-stream.c
scheduler/ipp.c
scheduler/job.c
tools/ipptool.c

index 6d51a97ad04b5ebfd582537c2b83d2473a31c437..bd7b0d9ac8971d860e8f1ad3dd00cbdc15207d0a 100644 (file)
@@ -289,7 +289,7 @@ cupsRasterInitHeader(
   }
 
   // Initialize the page header...
-  memset(h, 0, sizeof(cups_page_header_t));
+  memset(h, 0, sizeof(cups_page_header2_t));
 
   cupsCopyString(h->MediaClass, "PwgRaster", sizeof(h->MediaClass));
   cupsCopyString(h->MediaColor, media->color, sizeof(h->MediaColor));
index e8b5f94414147a26887c19411c8eb3b0c3abbed6..445076f7ff5d946285b59fd82b3f6bc3b8cbb916 100644 (file)
@@ -5774,7 +5774,7 @@ create_subscriptions(
   int                  interval,       /* notify-time-interval */
                        lease;          /* notify-lease-duration */
   unsigned             mask;           /* notify-events */
-  ipp_attribute_t      *notify_events,/* notify-events(-default) */
+  ipp_attribute_t      *notify_events, /* notify-events(-default) */
                        *notify_lease;  /* notify-lease-duration(-default) */
 
 
@@ -5884,19 +5884,16 @@ create_subscriptions(
 
     if (printer)
     {
-      notify_events = ippFindAttribute(printer->attrs, "notify-events-default",
-                                       IPP_TAG_KEYWORD);
-      notify_lease  = ippFindAttribute(printer->attrs,
-                                       "notify-lease-duration-default",
-                                       IPP_TAG_INTEGER);
+      // Get default events and lease duration for printer/class...
+      notify_events = ippFindAttribute(printer->attrs, "notify-events-default", IPP_TAG_KEYWORD);
 
-      if (notify_lease)
+      if ((notify_lease = ippFindAttribute(printer->attrs, "notify-lease-duration-default", IPP_TAG_INTEGER)) != NULL)
         lease = notify_lease->values[0].integer;
     }
     else
     {
+      // No defaults...
       notify_events = NULL;
-      notify_lease  = NULL;
     }
 
     while (attr && attr->group_tag != IPP_TAG_ZERO)
index 278bfb5012602ed4c59c44254f7f83abdfff1f6a..6b5ae84ec25ee7822806107e4d3bd3d6f0914f10 100644 (file)
@@ -767,8 +767,6 @@ cupsdContinueJob(cupsd_job_t *job)  /* I - Job */
       cupsdLogJob(job, CUPSD_LOG_DEBUG,
                  "Unable to add decompression filter - %s", strerror(errno));
 
-      cupsArrayDelete(filters);
-
       abort_message = "Stopping job because the scheduler ran out of memory.";
 
       goto abort_job;
index 1d975207b2d0756230f55abb13d9c79c31bd49ed..f485b457e7ab097f0e7272f665bf3142fa265d08 100644 (file)
@@ -2401,17 +2401,20 @@ do_tests(const char     *testfile,      // I - Test file to use
   if ((file = ippFileNew(data->parent, NULL, (ipp_ferror_cb_t)error_cb, data)) == NULL)
   {
     print_fatal_error(data, "Unable to create test file parser: %s", cupsGetErrorString());
-    return (false);
+    data->pass = false;
   }
-
-  if (!ippFileOpen(file, testfile, "r"))
+  else if (ippFileOpen(file, testfile, "r"))
   {
+    // Successfully opened file, read from it...
+    ippFileRead(file, (ipp_ftoken_cb_t)token_cb, true);
+  }
+  else
+  {
+    // Report the error...
     print_fatal_error(data, "Unable to open '%s': %s", testfile, cupsGetErrorString());
-    return (false);
+    data->pass = false;
   }
 
-  ippFileRead(file, (ipp_ftoken_cb_t)token_cb, true);
-
   ippFileDelete(file);
 
   // Close connection and return...