softpipe: Check for NULL pointer in sp_destroy_tex_tile_cache().
authorMichal Krol <michal@vmware.com>
Thu, 22 Jul 2010 16:32:31 +0000 (18:32 +0200)
committerMichal Krol <michal@vmware.com>
Fri, 23 Jul 2010 14:20:36 +0000 (16:20 +0200)
src/gallium/drivers/softpipe/sp_tex_tile_cache.c

index b3e1c49406971ddb6ac3188968d0e4a542aede4f..eb74f14a7bef52597c822e7e73ecd8884f1e0f70 100644 (file)
@@ -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 );
+   }
 }