[metacity/redhat-1888993: 2/2] window: check XResQueryClientIds return value




commit a7d6f11b3e712751b010a8f7622b148c93765f70
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sat Oct 17 20:38:28 2020 +0300

    window: check XResQueryClientIds return value

 src/core/window.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 171b1705..e089f1e8 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -9283,16 +9283,23 @@ meta_window_get_client_pid (MetaWindow *self)
       XResClientIdSpec spec;
       long num_ids;
       XResClientIdValue *client_ids;
+      Status status;
       long i;
 
       spec.client = self->xwindow;
       spec.mask = XRES_CLIENT_ID_PID_MASK;
 
-      XResQueryClientIds (self->display->xdisplay,
-                          1,
-                          &spec,
-                          &num_ids,
-                          &client_ids);
+      num_ids = 0;
+      client_ids = NULL;
+
+      status = XResQueryClientIds (self->display->xdisplay,
+                                   1,
+                                   &spec,
+                                   &num_ids,
+                                   &client_ids);
+
+      if (status != Success)
+        return -1;
 
       for (i = 0; i < num_ids; i++)
         {


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