From 7a6324dbfe8d354b9b5f3181af0ce6bebbb374cc Mon Sep 17 00:00:00 2001 From: Wang YanQing Date: Tue, 20 Mar 2012 11:49:42 +0800 Subject: glx:dri_common.c: check psc->driScreen->createDrawable return value createDrawable may return NULL value, we should check it, or it will make a segment failed. [minor-indent-issue-fixed-by: Yuanhan Liu] Signed-off-by: Wang YanQing Reviewed-by: Yuanhan Liu --- src/glx/dri_common.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src') diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c index 0e06d51b4c7..07fd0154e1b 100644 --- a/src/glx/dri_common.c +++ b/src/glx/dri_common.c @@ -403,6 +403,12 @@ driFetchDrawable(struct glx_context *gc, GLXDrawable glxDrawable) pdraw = psc->driScreen->createDrawable(psc, glxDrawable, glxDrawable, gc->config); + + if (pdraw == NULL) { + ErrorMessageF("failed to create drawable\n"); + return NULL; + } + if (__glxHashInsert(priv->drawHash, glxDrawable, pdraw)) { (*pdraw->destroyDrawable) (pdraw); return NULL; -- cgit v1.2.3