]> granicus.if.org Git - vim/commitdiff
patch 9.0.0339: no check if the return value of XChangeGC() is NULL v9.0.0339
authorBram Moolenaar <Bram@vim.org>
Wed, 31 Aug 2022 11:01:54 +0000 (12:01 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 31 Aug 2022 11:01:54 +0000 (12:01 +0100)
Problem:    No check if the return value of XChangeGC() is NULL.
Solution:   Only use the return value when it is not NULL. (closes #11020)

src/gui_x11.c
src/version.c

index 6e3e903be462b2721e3d9cc282f29bda5a81aac9..7293ac4900a6cac96bb7baaa7a703db398002025 100644 (file)
@@ -2231,10 +2231,14 @@ gui_x11_create_blank_mouse(void)
 {
     Pixmap blank_pixmap = XCreatePixmap(gui.dpy, gui.wid, 1, 1, 1);
     GC gc = XCreateGC(gui.dpy, blank_pixmap, (unsigned long)0, (XGCValues*)0);
-    XDrawPoint(gui.dpy, blank_pixmap, gc, 0, 0);
-    XFreeGC(gui.dpy, gc);
+
+    if (gc != NULL)
+    {
+       XDrawPoint(gui.dpy, blank_pixmap, gc, 0, 0);
+       XFreeGC(gui.dpy, gc);
+    }
     return XCreatePixmapCursor(gui.dpy, blank_pixmap, blank_pixmap,
-           (XColor*)&gui.norm_pixel, (XColor*)&gui.norm_pixel, 0, 0);
+                    (XColor*)&gui.norm_pixel, (XColor*)&gui.norm_pixel, 0, 0);
 }
 
 /*
index 80914885fe2c41f7aea4f6338e7a8796bd457fc2..354a2e43349cc41e8015fe2e430b835d4e23e1fe 100644 (file)
@@ -707,6 +707,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    339,
 /**/
     338,
 /**/