summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Alcantara <[email protected]>2012-08-17 14:08:10 -0300
committerBrian Paul <[email protected]>2012-08-23 09:17:23 -0600
commitb41f36bde778e6b11129f51de423b7c3aece26b4 (patch)
treebb88704e60e351c3b0e9fbdc7c6ab8d4549e4a6d
parent90bd1d52bbf95947955a66ec67f5f6c7dc87119a (diff)
egl_dri2: Fix segmentation fault
The segmentation fault occurs when DRI2 is not loaded up and dri2_setup_screen() function deferences dri2_dpy->dri2 (since it's NULL at this point). This patch fixes the segmentation fault by checking if dri2 pointer is not NULL before deferencing it. Signed-off-by: Paulo Alcantara <[email protected]> Reviewed-by: Ian Romanick <[email protected]> Signed-off-by: Brian Paul <[email protected]>
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 423d18d7759..7326b858433 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -481,7 +481,7 @@ dri2_setup_screen(_EGLDisplay *disp)
assert(dri2_dpy->dri2 || dri2_dpy->swrast);
disp->Extensions.KHR_surfaceless_context = EGL_TRUE;
- if (dri2_dpy->dri2->base.version >= 3) {
+ if (dri2_dpy->dri2 && dri2_dpy->dri2->base.version >= 3) {
disp->Extensions.KHR_create_context = EGL_TRUE;
if (dri2_dpy->robustness)