mesa: Free uniforms correclty.
authorAntoine Labour <piman@chromium.org>
Fri, 25 May 2012 01:15:44 +0000 (18:15 -0700)
committerStéphane Marchesin <marcheu@chromium.org>
Tue, 12 Jun 2012 21:42:22 +0000 (14:42 -0700)
This is an array of uniforms, not a single one.

Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
NOTE: This is a candidate for the 8.0 branch.

src/mesa/main/shaderobj.c

index 7eb6f0bdab05a637fdf3677b44b40023334fb616..d5ebf54af8e5f6f96c5304474f156c78143c28a0 100644 (file)
@@ -278,7 +278,8 @@ _mesa_clear_shader_program_data(struct gl_context *ctx,
                                 struct gl_shader_program *shProg)
 {
    if (shProg->UniformStorage) {
-      _mesa_uniform_detach_all_driver_storage(shProg->UniformStorage);
+      for (unsigned i = 0; i < shProg->NumUserUniformStorage; ++i)
+         _mesa_uniform_detach_all_driver_storage(&shProg->UniformStorage[i]);
       ralloc_free(shProg->UniformStorage);
       shProg->NumUserUniformStorage = 0;
       shProg->UniformStorage = NULL;