[lttng-dev] [lttng-tools PATCH 1/5] Tests: add a check in test_utils_expand_path to avoid segfault if result is NULL

Raphaël Beamonte raphael.beamonte at gmail.com
Thu Nov 14 19:58:31 EST 2013


Signed-off-by: Raphaël Beamonte <raphael.beamonte at gmail.com>
---
 tests/unit/test_utils_expand_path.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tests/unit/test_utils_expand_path.c b/tests/unit/test_utils_expand_path.c
index 27bfe8f..b79744b 100644
--- a/tests/unit/test_utils_expand_path.c
+++ b/tests/unit/test_utils_expand_path.c
@@ -135,7 +135,8 @@ static void test_utils_expand_path(void)
 		sprintf(name, "valid test case: %s", valid_tests_inputs[i].input);
 
 		result = utils_expand_path(valid_tests_inputs[i].input);
-		ok(strcmp(result, valid_tests_expected_results[i]) == 0, name);
+		ok(result != NULL &&
+				strcmp(result, valid_tests_expected_results[i]) == 0, name);
 
 		free(result);
 	}
-- 
1.7.10.4




More information about the lttng-dev mailing list