[Mesa-dev] [PATCH] glx:dri_common.c: check psc->driScreen->createDrawable return value
Wang YanQing
udknight at gmail.com
Tue Mar 20 02:24:06 PDT 2012
On Tue, Mar 20, 2012 at 08:49:25AM +0100, Michel Dänzer wrote:
> Please use one of the *MessageF() functions instead of fprintf directly.
createDrawable may return NULL value, we should check it, or it will
make a segment failed.
Signed-off-by: Wang YanQing <udknight at gmail.com>
---
src/glx/dri_common.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/glx/dri_common.c b/src/glx/dri_common.c
index 0e06d51..31e4d4d 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;
--
1.7.9.2.315.g25a78
More information about the mesa-dev
mailing list