aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/glx/glx_query.c6
-rw-r--r--src/glx/glxext.c4
2 files changed, 9 insertions, 1 deletions
diff --git a/src/glx/glx_query.c b/src/glx/glx_query.c
index 7064e7707bf..14e6f7c1c48 100644
--- a/src/glx/glx_query.c
+++ b/src/glx/glx_query.c
@@ -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);
diff --git a/src/glx/glxext.c b/src/glx/glxext.c
index 459b6c2b07e..6e6525aeeae 100644
--- a/src/glx/glxext.c
+++ b/src/glx/glxext.c
@@ -214,6 +214,8 @@ FreeScreenConfigs(struct glx_display * priv)
screens = ScreenCount(priv->dpy);
for (i = 0; i < screens; i++) {
psc = priv->screens[i];
+ if (!psc)
+ continue;
glx_screen_cleanup(psc);
#if defined(GLX_DIRECT_RENDERING) && !defined(GLX_USE_APPLEGL)
@@ -792,7 +794,7 @@ AllocAndFetchScreenConfigs(Display * dpy, struct glx_display * priv)
** First allocate memory for the array of per screen configs.
*/
screens = ScreenCount(dpy);
- priv->screens = malloc(screens * sizeof *priv->screens);
+ priv->screens = calloc(screens, sizeof *priv->screens);
if (!priv->screens)
return GL_FALSE;