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

[libvirt] [PATCH] polkit_driver: fix possible segfault



The changes in commit c7542573 introduced a segfault. Found by coverity.

Signed-off-by: Pavel Hrdina <phrdina redhat com>
---
 src/access/viraccessdriverpolkit.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/access/viraccessdriverpolkit.c b/src/access/viraccessdriverpolkit.c
index 2bc1842..2fd4fed 100644
--- a/src/access/viraccessdriverpolkit.c
+++ b/src/access/viraccessdriverpolkit.c
@@ -87,6 +87,12 @@ virAccessDriverPolkitGetCaller(const char *actionid,
                        actionid);
         return -1;
     }
+    if (!pid) {
+        virAccessError(VIR_ERR_INTERNAL_ERROR, "%s",
+                       _("No UNIX process ID available"));
+        goto cleanup;
+    }
+
     if (virIdentityGetUNIXProcessID(identity, pid) < 0)
         goto cleanup;
     if (virIdentityGetUNIXProcessTime(identity, startTime) < 0)
@@ -94,12 +100,6 @@ virAccessDriverPolkitGetCaller(const char *actionid,
     if (virIdentityGetUNIXUserID(identity, uid) < 0)
         goto cleanup;
 
-    if (!pid) {
-        virAccessError(VIR_ERR_INTERNAL_ERROR, "%s",
-                       _("No UNIX process ID available"));
-        goto cleanup;
-    }
-
     if (virIdentityGetUNIXProcessTime(identity, startTime) < 0)
         goto cleanup;
 
-- 
1.8.5.5


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