On 07/13/2016 05:54 PM, Vinson Lee wrote:
Fix pointer to local outside scope defect reported by Coverity.CID: 1362489 Fixes: 67db7e28be1f ("gl-3.2-adj-prims: new test of adjacency primitives with rendering options") Signed-off-by: Vinson Lee <[email protected]> --- tests/spec/gl-3.2/adj-prims.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/tests/spec/gl-3.2/adj-prims.c b/tests/spec/gl-3.2/adj-prims.c index 2df764e66d49..9d2f121f2a39 100644 --- a/tests/spec/gl-3.2/adj-prims.c +++ b/tests/spec/gl-3.2/adj-prims.c @@ -302,7 +302,9 @@ probe_prims(GLenum prim_mode, const float verts[][2], unsigned num_verts, for (prim = 0; prim < num_prims; prim++) { bool pass = false; - const float *expected_color = NULL, *bad_color = NULL; + const float *expected_color = NULL; + float bad_color[4]; + bool bad_color_found = false; int x, y, i; compute_probe_location(prim_mode, prim, verts, @@ -333,8 +335,13 @@ probe_prims(GLenum prim_mode, const float verts[][2], unsigned num_verts, // check for expected color if (colors_match(expected_color, buf[i])) pass = true; - else - bad_color = buf[i]; + else { + bad_color_found = true; + bad_color[0] = buf[i][0]; + bad_color[1] = buf[i][1]; + bad_color[2] = buf[i][2]; + bad_color[3] = buf[i][3]; + } } } } @@ -343,7 +350,7 @@ probe_prims(GLenum prim_mode, const float verts[][2], unsigned num_verts, printf("Failure for %s, " "prim %u wrong color at (%d,%d)\n", piglit_get_prim_name(prim_mode), prim, x, y); - if (expected_color && bad_color) { + if (expected_color && bad_color_found) { printf("Expected %.1g, %.1g, %.1g, %.1g\n", expected_color[0], expected_color[1],
Alternately, could we move the declaration of bad_color to the top of the function?
But this is OK too. Reviewed-by: Brian Paul <[email protected]> _______________________________________________ Piglit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/piglit
