state_stracker: Fix access to uninitialized memory.
authorMathias Fröhlich <Mathias.Froehlich@gmx.net>
Sat, 28 Jan 2012 17:55:08 +0000 (18:55 +0100)
committerMathias Fröhlich <Mathias.Froehlich@gmx.net>
Sat, 28 Jan 2012 23:15:48 +0000 (00:15 +0100)
Fix an access to uninitialized memory pointed out by valgrind in
glsl_to_tgsi_visitor::simplify_cmp(void).

Note: This is a candidate for the 8.0 branch.
Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
src/mesa/state_tracker/st_glsl_to_tgsi.cpp

index 188e8d9d5c922caf5abc924d9dbe764d5273a9e4..ab05896ce45fcd906ef4a90bf0199874ca5be8dc 100644 (file)
@@ -2978,7 +2978,7 @@ glsl_to_tgsi_visitor::simplify_cmp(void)
    if (!tempWrites) {
       return;
    }
-   memset(tempWrites, 0, sizeof(tempWrites));
+   memset(tempWrites, 0, sizeof(unsigned) * MAX_TEMPS);
    memset(outputWrites, 0, sizeof(outputWrites));
 
    foreach_iter(exec_list_iterator, iter, this->instructions) {