summaryrefslogtreecommitdiff
path: root/src/mesa/tnl
diff options
context:
space:
mode:
authorNicolai Haehnle <nhaehnle@gmail.com>2008-06-01 00:10:45 +0200
committerNicolai Haehnle <nhaehnle@gmail.com>2008-06-02 18:42:52 +0200
commit96adcc2e214e2fdc2ad15ecac20b1066c6cdd1ca (patch)
treeaac1b54bf3697e993269e6d4a8f10e1f55fb28c1 /src/mesa/tnl
parent934a53eb4406df9297f86cf12cacf5ba423e8af7 (diff)
[t_vp_build] Fix refcounting-related memory leak
This memory leak is identical to the earlier one in texenvprogram. Fixed by not creating an additional reference to new programs in cache_item. On top of that, remove some duplicated state setting.
Diffstat (limited to 'src/mesa/tnl')
-rw-r--r--src/mesa/tnl/t_vp_build.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/mesa/tnl/t_vp_build.c b/src/mesa/tnl/t_vp_build.c
index 46446d4885..d79f84f1eb 100644
--- a/src/mesa/tnl/t_vp_build.c
+++ b/src/mesa/tnl/t_vp_build.c
@@ -1511,7 +1511,8 @@ static void cache_item( GLcontext *ctx,
struct tnl_cache_item *c = CALLOC_STRUCT(tnl_cache_item);
c->hash = hash;
c->key = key;
- _mesa_reference_vertprog(ctx, &c->prog, prog);
+
+ c->prog = prog;
if (++cache->n_items > cache->size * 1.5)
rehash(cache);
@@ -1569,9 +1570,8 @@ void _tnl_UpdateFixedFunctionProgram( GLcontext *ctx )
ctx->Driver.ProgramStringNotify( ctx, GL_VERTEX_PROGRAM_ARB,
&newProg->Base );
+ /* Our ownership of newProg is transferred to the cache */
cache_item(ctx, tnl->vp_cache, hash, key, newProg);
-
- _mesa_reference_vertprog(ctx, &ctx->VertexProgram._TnlProgram, newProg);
}
else {
FREE(key);