mesa: In validate_program(), initialize errMsg for safety.
authorKenneth Graunke <kenneth@whitecape.org>
Sun, 31 Jul 2011 04:26:26 +0000 (21:26 -0700)
committerKenneth Graunke <kenneth@whitecape.org>
Fri, 5 Aug 2011 21:19:39 +0000 (14:19 -0700)
validate_program relies on validate_shader_program to fill in errMsg;
empirically, there exist cases where that doesn't happen.

While tracking those down may be worthwhile, initializing the string so
we don't try to ralloc_strdup random garbage also seems wise.

Fixes issues caught by valgrind while running some test case.

NOTE: This is a candidate for stable release branches.

Reviewed-by: Chad Versace <chad@chad-versace.us>
Signed-off-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/main/shaderapi.c

index 8df25c3f988d55f1e40119647ca7a348fc6bf253..74997eaaa771cdae54335e164334351acced7ed7 100644 (file)
@@ -1125,7 +1125,7 @@ static void
 validate_program(struct gl_context *ctx, GLuint program)
 {
    struct gl_shader_program *shProg;
-   char errMsg[100];
+   char errMsg[100] = "";
 
    shProg = _mesa_lookup_shader_program_err(ctx, program, "glValidateProgram");
    if (!shProg) {