diff mbox

[1/1] piglit-framework-cl.c: When extensions is NULL, don't segv

Message ID 1366580889-23552-1-git-send-email-tom.gall@linaro.org
State New
Headers show

Commit Message

Tom Gall April 21, 2013, 9:48 p.m. UTC
In check_platform_extensions, fix a bug where if extentions
was NULL, it'll segv.

Signed-off-by: Tom Gall <tom.gall@linaro.org>
---
 tests/util/piglit-framework-cl.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/tests/util/piglit-framework-cl.c b/tests/util/piglit-framework-cl.c
index deddc8d..4435bf7 100644
--- a/tests/util/piglit-framework-cl.c
+++ b/tests/util/piglit-framework-cl.c
@@ -84,9 +84,10 @@  print_test_info(const struct piglit_cl_test_config_header* config,
 
 bool check_platform_extensions(cl_platform_id platform_id, char* extensions)
 {
-	char* pch;
+	char* pch=NULL;
 
-	pch = strtok(extensions, " ");
+	if (extensions)
+		pch = strtok(extensions, " ");
 	while(pch != NULL) {
 		if(   strlen(pch) > 0
 		   && !piglit_cl_is_platform_extension_supported(platform_id, pch)) {