diff options
author | Nicolai Haehnle <[email protected]> | 2008-06-01 00:01:46 +0200 |
---|---|---|
committer | Nicolai Haehnle <[email protected]> | 2008-06-02 18:42:49 +0200 |
commit | 934a53eb4406df9297f86cf12cacf5ba423e8af7 (patch) | |
tree | 40263aac22dd23566bd42718d08cac6c3fbe64e9 /src/mesa | |
parent | 7ead1c5d061b86027cb5e821fdcaa9cdce1d9537 (diff) |
[texenvprogram] Fix refcounting-related memory leak.
All newly created programs have RefCount == 1, but the fragment program cache
added an additional reference in cache_item, with the result being that none
of the programs were ever freed.
Solve the problem by not creating the additional reference in cache_item.
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/texenvprogram.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mesa/main/texenvprogram.c b/src/mesa/main/texenvprogram.c index 68a4db91974..af19a38c42b 100644 --- a/src/mesa/main/texenvprogram.c +++ b/src/mesa/main/texenvprogram.c @@ -1204,7 +1204,7 @@ static void cache_item( GLcontext *ctx, c->key = _mesa_malloc(sizeof(*key)); memcpy(c->key, key, sizeof(*key)); - _mesa_reference_fragprog(ctx, &c->data, prog); + c->data = prog; if (cache->n_items > cache->size * 1.5) { if (cache->size < 1000) @@ -1271,6 +1271,7 @@ _mesa_UpdateTexEnvProgram( GLcontext *ctx ) create_new_program(ctx, &key, newProg); + /* Our ownership of newProg is transferred to the cache */ cache_item(ctx, &ctx->Texture.env_fp_cache, hash, &key, newProg); } |