i965: free shader's constant buffer in brwDeleteProgram()
authorBrian Paul <brianp@vmware.com>
Thu, 9 Apr 2009 16:33:08 +0000 (10:33 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 9 Apr 2009 16:33:16 +0000 (10:33 -0600)
Fixes mem leak observed with texcombine test.

src/mesa/drivers/dri/i965/brw_program.c

index 457bc2fc7f41bdba77da35187a61e1a4dfeec317..fbf1ddd1e3ecf617941bb48048223e2e7a187952 100644 (file)
@@ -95,6 +95,12 @@ static struct gl_program *brwNewProgram( GLcontext *ctx,
 static void brwDeleteProgram( GLcontext *ctx,
                              struct gl_program *prog )
 {
+   if (prog->Target == GL_FRAGMENT_PROGRAM_ARB) {
+      struct gl_fragment_program *fprog = (struct gl_fragment_program *) prog;
+      struct brw_fragment_program *brw_fprog = brw_fragment_program(fprog);
+      dri_bo_unreference(brw_fprog->const_buffer);
+   }
+
    _mesa_delete_program( ctx, prog );
 }