summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/common/meta.c
diff options
context:
space:
mode:
authorBen Widawsky <[email protected]>2015-03-06 17:31:00 -0800
committerBen Widawsky <[email protected]>2015-03-09 16:32:33 -0700
commit7aba4ab1f355ea1a5870b3deb4b295565132dfc5 (patch)
treec0869c0dc449762830f505dadd34e51ec9192473 /src/mesa/drivers/common/meta.c
parente95969cd9548033250ba12f2adf11740319b41e7 (diff)
meta: Plug memory leak
It looks like this has existed since commit f5a477ab76b6e0b268387699cd2253a43db0dfae Author: Ian Romanick <[email protected]> Date: Mon Dec 16 11:54:08 2013 -0800 meta: Refactor shader generation code out of mipmap generation path Valgrind was complaining on fbo-generatemipmap-formats v2: Instead, do the allocation after the early return block (v2) Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/mesa/drivers/common/meta.c')
-rw-r--r--src/mesa/drivers/common/meta.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c
index fdc4cf1e927..cf99d95638b 100644
--- a/src/mesa/drivers/common/meta.c
+++ b/src/mesa/drivers/common/meta.c
@@ -247,9 +247,9 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx,
struct blit_shader_table *table)
{
char *vs_source, *fs_source;
- void *const mem_ctx = ralloc_context(NULL);
struct blit_shader *shader = choose_blit_shader(target, table);
const char *vs_input, *vs_output, *fs_input, *vs_preprocess, *fs_preprocess;
+ void *mem_ctx;
if (ctx->Const.GLSLVersion < 130) {
vs_preprocess = "";
@@ -273,6 +273,8 @@ _mesa_meta_setup_blit_shader(struct gl_context *ctx,
return;
}
+ mem_ctx = ralloc_context(NULL);
+
vs_source = ralloc_asprintf(mem_ctx,
"%s\n"
"%s vec2 position;\n"