Mesa (master): glsl: free uniform_map on failure path.

Dave Airlie airlied at kemper.freedesktop.org
Tue Sep 2 06:06:15 UTC 2014


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

Author: Dave Airlie <airlied at redhat.com>
Date:   Tue Sep  2 09:54:36 2014 +1000

glsl: free uniform_map on failure path.

If we fails in reserve_explicit_locations, we leak uniform_map.

Reported-by: coverity scanner.

Reviewed-by: Tapani Pälli <tapani.palli at intel.com>
Signed-off-by: Dave Airlie <airlied at redhat.com>

---

 src/glsl/linker.cpp |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/glsl/linker.cpp b/src/glsl/linker.cpp
index d5473ad..57be493 100644
--- a/src/glsl/linker.cpp
+++ b/src/glsl/linker.cpp
@@ -2439,8 +2439,10 @@ check_explicit_uniform_locations(struct gl_context *ctx,
          ir_variable *var = node->as_variable();
          if ((var && var->data.mode == ir_var_uniform) &&
              var->data.explicit_location) {
-            if (!reserve_explicit_locations(prog, uniform_map, var))
+            if (!reserve_explicit_locations(prog, uniform_map, var)) {
+               delete uniform_map;
                return;
+            }
          }
       }
    }




More information about the mesa-commit mailing list