Mesa (master): glsl: Delete builtin_builder:: shader when destroying built-ins.

Kenneth Graunke kwg at kemper.freedesktop.org
Thu Sep 19 17:53:39 UTC 2013


Module: Mesa
Branch: master
Commit: d2d90d66d81d5f147b03628e1913bf7f9d2a0563
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=d2d90d66d81d5f147b03628e1913bf7f9d2a0563

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Mon Sep 16 23:35:41 2013 -0700

glsl: Delete builtin_builder::shader when destroying built-ins.

I would use _mesa_delete_shader, but it's declared static, and we don't
really need any of the stuff in it anyway.

This fixes a memory leak caught by Valgrind.

Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/glsl/builtin_functions.cpp |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/glsl/builtin_functions.cpp b/src/glsl/builtin_functions.cpp
index 31f7489..96358a7 100644
--- a/src/glsl/builtin_functions.cpp
+++ b/src/glsl/builtin_functions.cpp
@@ -580,6 +580,9 @@ builtin_builder::release()
 {
    ralloc_free(mem_ctx);
    mem_ctx = NULL;
+
+   ralloc_free(shader);
+   shader = NULL;
 }
 
 void




More information about the mesa-commit mailing list