i915g: If we have a program, that means the other fields are ours and we can free...
authorStéphane Marchesin <marcheu@chromium.org>
Wed, 29 Jun 2011 03:38:07 +0000 (20:38 -0700)
committerStéphane Marchesin <marcheu@chromium.org>
Wed, 29 Jun 2011 03:42:39 +0000 (20:42 -0700)
Otherwise they probably belong to draw.

src/gallium/drivers/i915/i915_state.c

index 7c888b798dc05a4d62a8aa9810d9bf034c3b99c3..f412626955df02bb7edc4e4da88808c66c1d4d80 100644 (file)
@@ -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);
 }