[Piglit] [PATCH] gl-1.0-readpixsanity: Initialize variables.

Vinson Lee vlee at freedesktop.org
Sat Dec 13 21:06:54 PST 2014


Fix uninitialized scalar variable defects reported by Coverity.

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 tests/spec/gl-1.0/readpix.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tests/spec/gl-1.0/readpix.c b/tests/spec/gl-1.0/readpix.c
index f233b07..e43a218 100644
--- a/tests/spec/gl-1.0/readpix.c
+++ b/tests/spec/gl-1.0/readpix.c
@@ -98,8 +98,8 @@ check_rgba(void)
 	bool pass = true;
 	double current_error = 0.0;
 	double err;
-	int xerr, yerr;
-	float expected[4], expected_rgba[4], actual_rgba[4];
+	int xerr = 0, yerr = 0;
+	float expected[4], expected_rgba[4] = { 0 }, actual_rgba[4] = { 0 };
 	const int w = piglit_width;
 	const int h = piglit_height;
 	GLfloat *buf = malloc(h * w * 4 * sizeof *buf);
@@ -199,14 +199,14 @@ check_depth(void)
 	int i, x, y;
 	int thresh = 1;
 	bool pass = true;
-	GLdouble expected, expected_depth, actual, actual_depth;
+	GLdouble expected, expected_depth = 0.0, actual, actual_depth = 0.0;
 	const int w = piglit_width;
 	const int h = piglit_height;
 	GLuint *buf = malloc(h * w * sizeof *buf);
 	double current_error = 0.0;
 	GLfloat dd;
 	double err;
-	int xerr, yerr;
+	int xerr = 0, yerr = 0;
 	GLint dbits;
 	glGetIntegerv(GL_DEPTH_BITS, &dbits);
 
-- 
1.9.2



More information about the Piglit mailing list