Mesa (master): i915g: If we have a program, that means the other fields are ours and we can free them.

Stephane Marchesin marcheu at kemper.freedesktop.org
Wed Jun 29 03:43:11 UTC 2011


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

Author: Stéphane Marchesin <marcheu at chromium.org>
Date:   Tue Jun 28 20:38:07 2011 -0700

i915g: If we have a program, that means the other fields are ours and we can free them.

Otherwise they probably belong to draw.

---

 src/gallium/drivers/i915/i915_state.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/i915/i915_state.c b/src/gallium/drivers/i915/i915_state.c
index 7c888b7..f412626 100644
--- a/src/gallium/drivers/i915/i915_state.c
+++ b/src/gallium/drivers/i915/i915_state.c
@@ -507,12 +507,14 @@ void i915_delete_fs_state(struct pipe_context *pipe, void *shader)
 {
    struct i915_fragment_shader *ifs = (struct i915_fragment_shader *) shader;
 
-   if (ifs->program)
+   if (ifs->program) {
       FREE(ifs->program);
+      ifs->program = NULL;
+      FREE((struct tgsi_token *)ifs->state.tokens);
+      ifs->state.tokens = NULL;
+   }
    ifs->program_len = 0;
 
-   FREE((struct tgsi_token *)ifs->state.tokens);
-
    FREE(ifs);
 }
 




More information about the mesa-commit mailing list