Mesa (master): st/dri: Assert pointer is not null before dereferencing.

Vinson Lee vlee at kemper.freedesktop.org
Sat Feb 27 10:02:46 UTC 2010


Module: Mesa
Branch: master
Commit: 307071fe1e2bfacba9780e2397785495ae0b0ea1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=307071fe1e2bfacba9780e2397785495ae0b0ea1

Author: Vinson Lee <vlee at vmware.com>
Date:   Sat Feb 27 02:01:56 2010 -0800

st/dri: Assert pointer is not null before dereferencing.

---

 src/gallium/state_trackers/dri/dri_drawable.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/dri/dri_drawable.c b/src/gallium/state_trackers/dri/dri_drawable.c
index 8843e08..4809b90 100644
--- a/src/gallium/state_trackers/dri/dri_drawable.c
+++ b/src/gallium/state_trackers/dri/dri_drawable.c
@@ -134,12 +134,13 @@ dri_get_buffers(__DRIdrawable * dPriv)
 
    if ((dri_screen->dri2.loader
         && (dri_screen->dri2.loader->base.version > 2)
-        && (dri_screen->dri2.loader->getBuffersWithFormat != NULL)))
+        && (dri_screen->dri2.loader->getBuffersWithFormat != NULL))) {
       buffers = (*dri_screen->dri2.loader->getBuffersWithFormat)
                 (dri_drawable, &dri_drawable->w, &dri_drawable->h,
                  drawable->attachments, drawable->num_attachments,
                  &count, dri_drawable->loaderPrivate);
-   else
+   } else {
+      assert(dri_screen->dri2.loader);
       buffers = (*dri_screen->dri2.loader->getBuffers) (dri_drawable,
                                                         &dri_drawable->w,
                                                         &dri_drawable->h,
@@ -148,6 +149,7 @@ dri_get_buffers(__DRIdrawable * dPriv)
                                                         num_attachments, &count,
                                                         dri_drawable->
                                                         loaderPrivate);
+   }
 
    if (buffers == NULL) {
       return;




More information about the mesa-commit mailing list