]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Fix Coverity-reported locking issue for subscriptions.
authorMichael R Sweet <msweet@msweet.org>
Thu, 13 Nov 2025 17:41:54 +0000 (12:41 -0500)
committerMichael R Sweet <msweet@msweet.org>
Thu, 13 Nov 2025 17:41:54 +0000 (12:41 -0500)
scheduler/ipp.c

index fa822603b0492c35929a4fa3e5bee5b1a92e3c6a..44e2512738e866a483d00add7ec8a7f832e8be41 100644 (file)
@@ -7041,8 +7041,12 @@ get_notifications(cupsd_client_t *con)   /* I - Client connection */
     * If we don't have any new events, nothing to do here...
     */
 
+    cupsRWLockRead(&sub->lock);
     if (min_seq > (sub->first_event_id + cupsArrayCount(sub->events)))
+    {
+      cupsRWUnlock(&sub->lock);
       continue;
+    }
 
    /*
     * Otherwise copy all of the new events...
@@ -7061,6 +7065,8 @@ get_notifications(cupsd_client_t *con)    /* I - Client connection */
                  ((cupsd_event_t *)cupsArrayIndex(sub->events, j))->attrs, NULL,
                 IPP_TAG_EVENT_NOTIFICATION, 0, NULL);
     }
+
+    cupsRWUnlock(&sub->lock);
   }
 }