Mesa (master): st/dri: Check for NULL before dereference and assignment.

Vinson Lee vlee at kemper.freedesktop.org
Sun Apr 18 06:41:01 UTC 2010


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

Author: Vinson Lee <vlee at vmware.com>
Date:   Sat Apr 17 23:40:14 2010 -0700

st/dri: Check for NULL before dereference and assignment.

---

 src/gallium/state_trackers/dri/drm/dri1.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/dri/drm/dri1.c b/src/gallium/state_trackers/dri/drm/dri1.c
index bdf2516..e216e46 100644
--- a/src/gallium/state_trackers/dri/drm/dri1.c
+++ b/src/gallium/state_trackers/dri/drm/dri1.c
@@ -89,10 +89,18 @@ dri1_propagate_drawable_change(struct dri_context *ctx)
 {
    __DRIdrawable *dPriv = ctx->dPriv;
    __DRIdrawable *rPriv = ctx->rPriv;
-   struct dri_drawable *draw = dri_drawable(dPriv);
-   struct dri_drawable *read = dri_drawable(rPriv);
+   struct dri_drawable *draw;
+   struct dri_drawable *read;
    boolean flushed = FALSE;
 
+   if (dPriv) {
+      draw = dri_drawable(dPriv);
+   }
+
+   if (rPriv) {
+      read = dri_drawable(rPriv);
+   }
+
    if (dPriv && draw->texture_stamp != dPriv->lastStamp) {
       ctx->st->flush(ctx->st, PIPE_FLUSH_RENDER_CACHE, NULL);
       flushed = TRUE;




More information about the mesa-commit mailing list