mesa/st: don't leak name
authorRob Clark <robclark@freedesktop.org>
Wed, 18 May 2016 13:19:00 +0000 (09:19 -0400)
committerRob Clark <robclark@freedesktop.org>
Wed, 18 May 2016 13:20:22 +0000 (09:20 -0400)
Pointed out by coverity.

Signed-off-by: Rob Clark <robclark@freedesktop.org>
src/mesa/state_tracker/st_nir_lower_builtin.c

index b4da9017d5cf7afeb624b828a1d0eb9f0a73bcf3..20b04d1e20f6950e27560eb6733dbc43fe5ddbce 100644 (file)
@@ -128,9 +128,12 @@ get_variable(lower_builtin_state *state, nir_deref_var *deref,
 
    char *name = _mesa_program_state_string((gl_state_index *)tokens);
 
-   nir_foreach_variable(var, &shader->uniforms)
-      if (strcmp(var->name, name) == 0)
+   nir_foreach_variable(var, &shader->uniforms) {
+      if (strcmp(var->name, name) == 0) {
+         free(name);
          return var;
+      }
+   }
 
    /* variable doesn't exist yet, so create it: */
    nir_variable *var =