Mesa (master): softpipe: Check for NULL pointer in sp_destroy_tile_cache().

Michał Król michal at kemper.freedesktop.org
Fri Jul 23 14:24:16 UTC 2010


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

Author: Michal Krol <michal at vmware.com>
Date:   Thu Jul 22 18:32:50 2010 +0200

softpipe: Check for NULL pointer in sp_destroy_tile_cache().

---

 src/gallium/drivers/softpipe/sp_tile_cache.c |   18 ++++++++++--------
 1 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_tile_cache.c b/src/gallium/drivers/softpipe/sp_tile_cache.c
index d7bc356..bf33fd9 100644
--- a/src/gallium/drivers/softpipe/sp_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tile_cache.c
@@ -115,16 +115,18 @@ sp_create_tile_cache( struct pipe_context *pipe )
 void
 sp_destroy_tile_cache(struct softpipe_tile_cache *tc)
 {
-   uint pos;
+   if (tc) {
+      uint pos;
 
-   for (pos = 0; pos < NUM_ENTRIES; pos++) {
-      /*assert(tc->entries[pos].x < 0);*/
-   }
-   if (tc->transfer) {
-      tc->pipe->transfer_destroy(tc->pipe, tc->transfer);
-   }
+      for (pos = 0; pos < NUM_ENTRIES; pos++) {
+         /*assert(tc->entries[pos].x < 0);*/
+      }
+      if (tc->transfer) {
+         tc->pipe->transfer_destroy(tc->pipe, tc->transfer);
+      }
 
-   FREE( tc );
+      FREE( tc );
+   }
 }
 
 




More information about the mesa-commit mailing list