[metacity/test: 1/3] util: avoid possible null pointer dereference



commit 2be06e7c4da3e7d2fb75e602de6fd9c31b1a33a6
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Sun Mar 1 18:23:48 2020 +0200

    util: avoid possible null pointer dereference

 src/core/util.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/core/util.c b/src/core/util.c
index 193bb82a..5c78957c 100644
--- a/src/core/util.c
+++ b/src/core/util.c
@@ -510,15 +510,16 @@ meta_xserver_region_equal (Display       *xdisplay,
   if (region1 == region2)
     return TRUE;
 
-  if ((region1 != None && region2 == None) ||
-      (region1 == None && region2 != None))
+  if (region1 == None || region2 == None)
     return FALSE;
 
   region1_rects = XFixesFetchRegion (xdisplay, region1, &region1_nrects);
   region2_rects = XFixesFetchRegion (xdisplay, region2, &region2_nrects);
 
-  if ((region1_rects != NULL && region2_rects == NULL) ||
-      (region1_rects == NULL && region2_rects != NULL))
+  if (region1_rects == NULL && region2_rects == NULL)
+    return TRUE;
+
+  if (region1_rects == NULL || region2_rects == NULL)
     {
       if (region1_rects != NULL)
         XFree (region1_rects);


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