[igt-dev] [PATCH i-g-t 2/3] runner/resultgen: Don't pass NULL to str*() functions

Arkadiusz Hiler arkadiusz.hiler at intel.com
Thu Jun 20 12:29:01 UTC 2019


If we don't get values from the JSON strlen() and strcmp() on them would
dereference NULL pointer.

Cc: Petri Latvala <petri.latvala at intel.com>
Signed-off-by: Arkadiusz Hiler <arkadiusz.hiler at intel.com>
---
 runner/resultgen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/runner/resultgen.c b/runner/resultgen.c
index 7b4cd519..58b95220 100644
--- a/runner/resultgen.c
+++ b/runner/resultgen.c
@@ -866,7 +866,7 @@ static void fill_from_journal(int fd,
 
 static void override_result_single(struct json_object *obj)
 {
-	const char *errtext = NULL, *result = NULL;
+	const char *errtext = "", *result = "";
 	struct json_object *textobj;
 	bool dmesgwarns = false;
 
-- 
2.21.0



More information about the igt-dev mailing list