glx: Fix SEGV due to dereferencing a NULL ptr from XCB-GLX.
[mesa.git] / src / glx / glx_query.c
index 7064e7707bfd0b91c53c6249d52a416d553fbc30..14e6f7c1c487966c2d7c17f9c55ab3e2d93ff8e5 100644 (file)
@@ -50,6 +50,9 @@ __glXQueryServerString(Display * dpy, int opcode, CARD32 screen, CARD32 name)
                                                                     name),
                                         NULL);
 
+   if (!reply)
+      return NULL;
+
    /* The spec doesn't mention this, but the Xorg server replies with
     * a string already terminated with '\0'. */
    uint32_t len = xcb_glx_query_server_string_string_length(reply);
@@ -74,6 +77,9 @@ __glXGetString(Display * dpy, int opcode, CARD32 contextTag, CARD32 name)
                                                                  name),
                                                                 NULL);
 
+   if (!reply)
+      return NULL;
+
    /* The spec doesn't mention this, but the Xorg server replies with
     * a string already terminated with '\0'. */
    uint32_t len = xcb_glx_get_string_string_length(reply);