diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2020-03-01 18:23:48 +0200 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2020-03-01 18:23:48 +0200 |
commit | 2be06e7c4da3e7d2fb75e602de6fd9c31b1a33a6 (patch) | |
tree | f8a1535ac7855cc7a940aa9f4fa259d82045ca81 | |
parent | 0c9ad8932cdd49a308fcaa273ea45fa677668ea1 (diff) | |
download | metacity-2be06e7c4da3e7d2fb75e602de6fd9c31b1a33a6.tar.gz |
util: avoid possible null pointer dereference
-rw-r--r-- | src/core/util.c | 9 |
1 files 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, ®ion1_nrects); region2_rects = XFixesFetchRegion (xdisplay, region2, ®ion2_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); |