[Mesa-dev] [PATCH] linker: Fix memory leak in count_uniform_size::visit_field.
ppaalanen at gmail.com
Fri Mar 30 00:38:39 PDT 2012
On Thu, 29 Mar 2012 14:16:10 -0700
Ian Romanick <idr at freedesktop.org> wrote:
> On 03/29/2012 10:41 AM, Kenneth Graunke wrote:
> > On 03/28/2012 11:43 PM, Vinson Lee wrote:
> >> Fixes a Coverity resource leak defect.
> >> NOTE: This is a candidate for the 8.0 branch.
> >> Signed-off-by: Vinson Lee<vlee at freedesktop.org>
> >> ---
> >> src/glsl/link_uniforms.cpp | 1 +
> >> 1 file changed, 1 insertion(+)
> >> diff --git a/src/glsl/link_uniforms.cpp b/src/glsl/link_uniforms.cpp
> >> index 613c9b7..86717f9 100644
> >> --- a/src/glsl/link_uniforms.cpp
> >> +++ b/src/glsl/link_uniforms.cpp
> >> @@ -175,6 +175,7 @@ private:
> >> char *key = strdup(name);
> >> this->map->put(this->num_active_uniforms, key);
> >> + free(key);
> >> /* Each leaf uniform occupies one entry in the list of active
> >> * uniforms.
> > It looks like string_to_uint_map::put (hash_table.h:247) already calls
> > strdup() on the key. So I think we should just do:
> > this->map->put(this->num_active_uniforms, name);
> > and not bother duplicating it twice.
> I think that's correct. I seem to recall a similar case being fixed a
> few months ago.
It was exactly this case with a suggested solution as Kenneth's above,
and no, it wasn't fixed. I could not produce a non-regressing piglit
test soon enough, had to move on, and didn't push it. My piglit results
Glad to see it's getting fixed now.
More information about the mesa-dev