From: Wang YanQing Date: Tue, 20 Mar 2012 03:49:42 +0000 (+0800) Subject: glx:dri_common.c: check psc->driScreen->createDrawable return value X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7a6324dbfe8d354b9b5f3181af0ce6bebbb374cc;p=mesa.git 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 --- 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;