Mesa (master): llvmpipe: guard against NULL task->query pointer

Keith Whitwell keithw at kemper.freedesktop.org
Tue Nov 2 17:00:20 UTC 2010


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

Author: Keith Whitwell <keithw at vmware.com>
Date:   Tue Nov  2 12:05:46 2010 +0000

llvmpipe: guard against NULL task->query pointer

This doesn't seem like it should be possible, but some test suites
manage to hit this case.  Avoid crashing release builds under those
circumstances.

---

 src/gallium/drivers/llvmpipe/lp_rast.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_rast.c b/src/gallium/drivers/llvmpipe/lp_rast.c
index d358a98..decf3bd 100644
--- a/src/gallium/drivers/llvmpipe/lp_rast.c
+++ b/src/gallium/drivers/llvmpipe/lp_rast.c
@@ -485,8 +485,11 @@ static void
 lp_rast_end_query(struct lp_rasterizer_task *task,
                   const union lp_rast_cmd_arg arg)
 {
-   task->query->count[task->thread_index] += task->vis_counter;
-   task->query = NULL;
+   assert(task->query);
+   if (task->query) {
+      task->query->count[task->thread_index] += task->vis_counter;
+      task->query = NULL;
+   }
 }
 
 




More information about the mesa-commit mailing list