[Piglit] [PATCH] arb_uniform_buffer_object: Fix use after free.

Vinson Lee vlee at freedesktop.org
Wed Nov 28 22:55:36 PST 2012


Fixes use after free defect reported by Coverity.

Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 .../spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c
index bd595ae..f15a41e 100644
--- a/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c
+++ b/tests/spec/arb_uniform_buffer_object/getactiveuniformsiv-uniform-type.c
@@ -63,11 +63,13 @@ test_format(const struct uniform_type *type)
 
 	asprintf(&fs_source, fs_template, type->type);
 	fs = piglit_compile_shader_text(GL_FRAGMENT_SHADER, fs_source);
-	free(fs_source);
 	prog = piglit_link_simple_program(0, fs);
 	if (!fs || !prog) {
 		fprintf(stderr, "Failed to compile shader:\n%s", fs_source);
+		free(fs_source);
 		piglit_report_result(PIGLIT_FAIL);
+	} else {
+		free(fs_source);
 	}
 
 	glGetUniformIndices(prog, 1, &uniform_name, &uniform_index);
-- 
1.8.0



More information about the Piglit mailing list