glsl: free uniform_map on failure path.
authorDave Airlie <airlied@redhat.com>
Mon, 1 Sep 2014 23:54:36 +0000 (09:54 +1000)
committerDave Airlie <airlied@redhat.com>
Tue, 2 Sep 2014 06:05:52 +0000 (16:05 +1000)
If we fails in reserve_explicit_locations, we leak uniform_map.

Reported-by: coverity scanner.
Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
src/glsl/linker.cpp

index d5473adc36ee70f3b8f73437e4655a6cf2d26308..57be4931d780291a4dbb48f9b6a649410c2e72dc 100644 (file)
@@ -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;
+            }
          }
       }
    }