From: Michael R Sweet Date: Wed, 13 Sep 2023 17:47:55 +0000 (-0400) Subject: Fix Coverity-discovered issues. X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=08d2576b02fced09b94bcc205cfa7d08300abac3;p=thirdparty%2Fcups.git Fix Coverity-discovered issues. --- diff --git a/cups/raster-stream.c b/cups/raster-stream.c index 6d51a97ad0..bd7b0d9ac8 100644 --- a/cups/raster-stream.c +++ b/cups/raster-stream.c @@ -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)); diff --git a/scheduler/ipp.c b/scheduler/ipp.c index e8b5f94414..445076f7ff 100644 --- a/scheduler/ipp.c +++ b/scheduler/ipp.c @@ -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) diff --git a/scheduler/job.c b/scheduler/job.c index 278bfb5012..6b5ae84ec2 100644 --- a/scheduler/job.c +++ b/scheduler/job.c @@ -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; diff --git a/tools/ipptool.c b/tools/ipptool.c index 1d975207b2..f485b457e7 100644 --- a/tools/ipptool.c +++ b/tools/ipptool.c @@ -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...