mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
[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.
This commit is contained in:
parent
934a53eb44
commit
96adcc2e21
1 changed files with 3 additions and 3 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue