]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
More Coverity fixes.
authorMichael R Sweet <msweet@msweet.org>
Wed, 22 May 2024 20:48:31 +0000 (16:48 -0400)
committerMichael R Sweet <msweet@msweet.org>
Wed, 22 May 2024 20:48:31 +0000 (16:48 -0400)
backend/dnssd.c
backend/ipp.c
scheduler/job.c

index f8d6a58498bc7587ab0e53d4bf402152c2145e1b..006becbdbe55fb72e4f63ad331cd03e32c3d8ed0 100644 (file)
@@ -224,11 +224,14 @@ main(int  argc,                           // I - Number of command-line args
 
       bool done = sent == cupsArrayGetCount(Devices) && (time(NULL) - start) > 5;
 
-      cupsMutexUnlock(&DevicesMutex);
-
       if (done)
+      {
+       cupsMutexUnlock(&DevicesMutex);
        break;
+      }
     }
+
+    cupsMutexUnlock(&DevicesMutex);
   }
 
   return (CUPS_BACKEND_OK);
index 17966f7f31d02f996001537fef915dc4148f1293..3b861be029668339d12b088a10af98907d360ce5 100644 (file)
@@ -3583,12 +3583,12 @@ update_reasons(ipp_attribute_t *attr,   /* I - printer-state-reasons or NULL */
   remprefix = "STATE: -";
   remptr    = rem;
 
+  cupsMutexLock(&report_mutex);
+
   fprintf(stderr, "DEBUG2: op='%c', new_reasons=%d, state_reasons=%d\n",
           op ? op : ' ', cupsArrayCount(new_reasons),
          cupsArrayCount(state_reasons));
 
-  cupsMutexLock(&report_mutex);
-
   if (op == '+')
   {
    /*
index 7cd73da4bd026a31013023e4cbc8eecf3a7a6922..e9d0944fbce341ffa25e4f34d7a126b1688ed650 100644 (file)
@@ -1975,6 +1975,9 @@ cupsdLoadJob(cupsd_job_t *job)            /* I - Job */
          }
 
          job->num_files = 0;
+
+         cupsRWUnlock(&MimeDatabase->lock);
+
          return (0);
        }
 
@@ -2614,7 +2617,7 @@ cupsdSetJobState(
        * reasons message there...
        */
 
-       if (action >= CUPSD_JOB_FORCE && job && job->printer)
+       if (action >= CUPSD_JOB_FORCE && job->printer)
          ippSetString(job->attrs, &job->reasons, 0, "processing-to-stop-point");
        break;
   }