summaryrefslogtreecommitdiffstats
path: root/src/egl/drivers/dri2/egl_dri2.c
diff options
context:
space:
mode:
authorJosé Fonseca <[email protected]>2011-05-12 15:23:48 +0100
committerJosé Fonseca <[email protected]>2011-05-12 15:23:48 +0100
commit4a47d6d46b397bf31a1fd22d35bd40ef03bd9357 (patch)
tree6fe6f64885f8f115f127bf5c3e60563440500b4c /src/egl/drivers/dri2/egl_dri2.c
parent6c26072bd151ee7abc897aad63cd55ec5f15762e (diff)
egl/dri2: Prevent uninitialized variable dereference.
Diffstat (limited to 'src/egl/drivers/dri2/egl_dri2.c')
-rw-r--r--src/egl/drivers/dri2/egl_dri2.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/egl/drivers/dri2/egl_dri2.c b/src/egl/drivers/dri2/egl_dri2.c
index 1acec51a433..0e1a1b52a4c 100644
--- a/src/egl/drivers/dri2/egl_dri2.c
+++ b/src/egl/drivers/dri2/egl_dri2.c
@@ -205,8 +205,7 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
*/
num_configs = 0;
}
-
- if (num_configs == 0) {
+ else if (num_configs == 0) {
conf = malloc(sizeof *conf);
if (conf == NULL)
return NULL;
@@ -224,6 +223,10 @@ dri2_add_config(_EGLDisplay *disp, const __DRIconfig *dri_config, int id,
_eglLinkConfig(&conf->base);
}
+ else {
+ assert(0);
+ return NULL;
+ }
conf->base.SurfaceType |= surface_type & (!double_buffer ? EGL_PIXMAP_BIT:
(EGL_WINDOW_BIT | EGL_PBUFFER_BIT | EGL_SWAP_BEHAVIOR_PRESERVED_BIT));