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

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


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

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

softpipe: Check for NULL pointer in sp_destroy_tex_tile_cache().

---

 src/gallium/drivers/softpipe/sp_tex_tile_cache.c |   24 +++++++++++----------
 1 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
index b3e1c49..eb74f14 100644
--- a/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
+++ b/src/gallium/drivers/softpipe/sp_tex_tile_cache.c
@@ -63,19 +63,21 @@ sp_create_tex_tile_cache( struct pipe_context *pipe )
 void
 sp_destroy_tex_tile_cache(struct softpipe_tex_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);
-   }
-   if (tc->tex_trans) {
-      tc->pipe->transfer_destroy(tc->pipe, tc->tex_trans);
-   }
+      for (pos = 0; pos < NUM_ENTRIES; pos++) {
+         /*assert(tc->entries[pos].x < 0);*/
+      }
+      if (tc->transfer) {
+         tc->pipe->transfer_destroy(tc->pipe, tc->transfer);
+      }
+      if (tc->tex_trans) {
+         tc->pipe->transfer_destroy(tc->pipe, tc->tex_trans);
+      }
 
-   FREE( tc );
+      FREE( tc );
+   }
 }
 
 




More information about the mesa-commit mailing list