[libvirt] [PATCH] libvirtd: avoid false-positive NULL-deref warning from clang

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* daemon/libvirtd.c (qemudWorker): Rewrite loop to silence a
warning.
---

Here's the rewrite in patch form.

 daemon/libvirtd.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index 9bdbecb..9e16883 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -1502,16 +1502,15 @@ static void *qemudWorker(void *data)
         struct qemud_client_message *msg;

         virMutexLock(&server->lock);
-        while (((client = qemudPendingJob(server)) == NULL) &&
-               !worker->quitRequest) {
-            if (virCondWait(&server->job, &server->lock) < 0) {
+        while ((client = qemudPendingJob(server)) == NULL) {
+            if (worker->quitRequest ||
+                virCondWait(&server->job, &server->lock) < 0) {
                 virMutexUnlock(&server->lock);
                 return NULL;
             }
         }
         if (worker->quitRequest) {
-            if (client)
-                virMutexUnlock(&client->lock);
+            virMutexUnlock(&client->lock);
             virMutexUnlock(&server->lock);
             return NULL;
         }
-- 
1.6.6.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]