summaryrefslogtreecommitdiffstats
path: root/src/glx
diff options
context:
space:
mode:
authornobled <[email protected]>2010-08-19 14:06:21 -0400
committerEric Anholt <[email protected]>2011-02-11 18:19:10 -0800
commitb5dc40710d0e5edffb9f673dfbf26df4d0043eef (patch)
tree94571ea6e53cbe459dae5862e64a018d941355f7 /src/glx
parentdf54b53b7d12a3bca5867b6649cb308feb36f0da (diff)
glx: Put null check before use
'dpy' was being checked for null *after* it was already used once. Also add a null check for psc, and drop gc's redundant initialization.
Diffstat (limited to 'src/glx')
-rw-r--r--src/glx/glxcmds.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/glx/glxcmds.c b/src/glx/glxcmds.c
index d12ff9684e2..80eaf72b7d5 100644
--- a/src/glx/glxcmds.c
+++ b/src/glx/glxcmds.c
@@ -215,12 +215,16 @@ CreateContext(Display * dpy, int generic_id,
Bool allowDirect,
unsigned code, int renderType, int screen)
{
- struct glx_context *gc = NULL;
- struct glx_screen *const psc = GetGLXScreenConfigs(dpy, screen);
+ struct glx_context *gc;
+ struct glx_screen *psc;
struct glx_context *shareList = (struct glx_context *) shareList_user;
if (dpy == NULL)
return NULL;
+ psc = GetGLXScreenConfigs(dpy, screen);
+ if (psc == NULL)
+ return NULL;
+
if (generic_id == None)
return NULL;