mesa: Use static buffer for uniform name
authorIan Romanick <ian.d.romanick@intel.com>
Tue, 15 Nov 2011 00:52:05 +0000 (16:52 -0800)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 11 Jan 2012 20:51:24 +0000 (12:51 -0800)
Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/ff_fragment_shader.cpp

index 49a8af090f59868fbcca4a593ee290e12036c47a..165230c13b1c4b80afb2a0a407a215a8d9a1547b 100644 (file)
@@ -1509,7 +1509,12 @@ create_new_program(struct gl_context *ctx, struct state_key *key)
    _mesa_associate_uniform_storage(ctx, p.shader_program, fp->Parameters);
 
    for (unsigned int i = 0; i < MAX_TEXTURE_UNITS; i++) {
-      char *name = ralloc_asprintf(p.mem_ctx, "sampler_%d", i);
+      /* Enough space for 'sampler_999\0'.
+       */
+      char name[12];
+
+      snprintf(name, sizeof(name), "sampler_%d", i);
+
       int loc = _mesa_get_uniform_location(ctx, p.shader_program, name);
       if (loc != -1) {
         unsigned base;