[Piglit] [PATCH] max-texture-size: Do not allocate memory for an unexpected target.

Vinson Lee vlee at freedesktop.org
Sat Dec 8 21:40:27 PST 2012


Fixes uninitialized scalar variable defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 tests/texturing/max-texture-size.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tests/texturing/max-texture-size.c b/tests/texturing/max-texture-size.c
index d59b8e0..a05518c 100644
--- a/tests/texturing/max-texture-size.c
+++ b/tests/texturing/max-texture-size.c
@@ -151,6 +151,10 @@ initTexData (GLenum target, int sideLength)
 		nPixels = (uint64_t)(sideLength) *
 			  (uint64_t)(sideLength) *
 			  (uint64_t)(sideLength);
+	else {
+		assert(!"Unexpected target");
+		return NULL;
+	}
 
 	/* Allocate sufficiently large data array and initialize to zero */
 	return ((GLfloat *) calloc(nPixels * COLOR_COMPONENTS, sizeof(float)));
-- 
1.8.0.1



More information about the Piglit mailing list