glx:dri_common.c: check psc->driScreen->createDrawable return value
authorWang YanQing <udknight@gmail.com>
Tue, 20 Mar 2012 03:49:42 +0000 (11:49 +0800)
committerYuanhan Liu <yuanhan.liu@linux.intel.com>
Wed, 28 Mar 2012 01:51:16 +0000 (09:51 +0800)
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 <udknight@gmail.com>
Reviewed-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
src/glx/dri_common.c

index 0e06d51b4c7d6a69633aef8f6319907976dd0742..07fd0154e1b5e31711b827ff39f88b42e7b2f02b 100644 (file)
@@ -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;