summaryrefslogtreecommitdiff
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2005-08-09 16:11:28 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2005-08-09 16:11:28 +0000
commitc91720fb1ab06af683a33b8734391a5a73cc23e5 (patch)
treef8d973b408e2512136de1c05296bbec4edc9e7ee /src/mesa/tnl
parentd2e289c70f2b9fb882f5b3992b610a9ea5c8357c (diff)
Decrement the context's refcounts on part-used storage structs on
context destroy. Fixes memory leak.
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_save_api.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mesa/tnl/t_save_api.c b/src/mesa/tnl/t_save_api.c
index b3637cf8d9..b43b048083 100644
--- a/src/mesa/tnl/t_save_api.c
+++ b/src/mesa/tnl/t_save_api.c
@@ -1708,5 +1708,15 @@ void _tnl_save_init( GLcontext *ctx )
*/
void _tnl_save_destroy( GLcontext *ctx )
{
- (void) ctx;
+ TNLcontext *tnl = TNL_CONTEXT(ctx);
+
+ /* Decrement the refcounts. References may still be held by
+ * display lists yet to be destroyed, so it may not yet be time to
+ * free these items.
+ */
+ if ( --tnl->save.prim_store->refcount == 0 )
+ FREE( tnl->save.prim_store );
+
+ if ( --tnl->save.vertex_store->refcount == 0 )
+ FREE( tnl->save.vertex_store );
}