draw: Fix memory leak in gs code
authorJakob Bornecrantz <jakob@vmware.com>
Sat, 16 Jan 2010 09:30:28 +0000 (09:30 +0000)
committerJakob Bornecrantz <jakob@vmware.com>
Sat, 16 Jan 2010 10:44:57 +0000 (10:44 +0000)
src/gallium/auxiliary/draw/draw_context.c
src/gallium/auxiliary/draw/draw_gs.c
src/gallium/auxiliary/draw/draw_private.h

index 667aa46b208ce3f4bc90fcc56b0d0087c053ff13..e90dfc5aec4b53557898520e8d4cb9308b8e564e 100644 (file)
@@ -95,6 +95,7 @@ void draw_destroy( struct draw_context *draw )
    draw_pipeline_destroy( draw );
    draw_pt_destroy( draw );
    draw_vs_destroy( draw );
+   draw_gs_destroy( draw );
 
    FREE( draw );
 }
index 5db2e755423c900bd3ca083f46c06dcbc2b5d3e0..daf8d071f123d43fb0955abe1a0c134a6c4fc4a9 100644 (file)
@@ -59,6 +59,15 @@ draw_gs_init( struct draw_context *draw )
    return TRUE;
 }
 
+void draw_gs_destroy( struct draw_context *draw )
+{
+   if (!draw->gs.machine)
+      return;
+
+   align_free(draw->gs.machine->Primitives);
+
+   tgsi_exec_machine_destroy(draw->gs.machine);
+}
 
 void draw_gs_set_constants( struct draw_context *draw,
                             const float (*constants)[4],
index d5e1c0ce2a2780af5d3b59b1808de63f2ead8d98..ef49e575366f356ec74165ba36989a75a3a06397 100644 (file)
@@ -269,6 +269,7 @@ boolean draw_gs_init( struct draw_context *draw );
 void draw_gs_set_constants( struct draw_context *,
                             const float (*constants)[4],
                             unsigned size );
+void draw_gs_destroy( struct draw_context *draw );
 
 /*******************************************************************************
  * Common shading code: