[Mesa-dev] [PATCH 1/2] linker: fix strdup memory leak
Pekka Paalanen
ppaalanen at gmail.com
Wed Dec 14 23:26:29 PST 2011
string_to_uint_map::put() already does a strdup() for the key argument,
so we leak the memory allocated by strdup() in link_uniforms.cpp.
Remove the extra strdup(), fixes a few Valgrind detected leaks.
Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
---
src/glsl/link_uniforms.cpp | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
index c7de480..f6094d7 100644
--- a/src/glsl/link_uniforms.cpp
+++ b/src/glsl/link_uniforms.cpp
@@ -174,8 +174,7 @@ private:
if (this->map->get(id, name))
return;
- char *key = strdup(name);
- this->map->put(this->num_active_uniforms, key);
+ this->map->put(this->num_active_uniforms, name);
/* Each leaf uniform occupies one entry in the list of active
* uniforms.
--
1.7.3.4
More information about the mesa-dev
mailing list