From 4591a8220989d9ba5779d1c13f35b65c532d2a09 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Wed, 17 May 2017 17:09:23 -0700 Subject: [PATCH] test_report_supported_opcodes_rctd: Fix a NULL pointer dereference Avoid that the test tool crashes due to a NULL pointer dereference if unmarshalling the Data-In buffer fails. Signed-off-by: Bart Van Assche --- test-tool/test_report_supported_opcodes_rctd.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test-tool/test_report_supported_opcodes_rctd.c b/test-tool/test_report_supported_opcodes_rctd.c index 4129f2d..81ad5bd 100644 --- a/test-tool/test_report_supported_opcodes_rctd.c +++ b/test-tool/test_report_supported_opcodes_rctd.c @@ -70,6 +70,8 @@ test_report_supported_opcodes_rctd(void) logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); rsoc = scsi_datain_unmarshall(rso_task); CU_ASSERT_NOT_EQUAL(rsoc, NULL); + if (!rsoc) + goto free_task; logging(LOG_VERBOSE, "Verify that all returned command descriptors " "have a timeout description"); @@ -94,5 +96,6 @@ test_report_supported_opcodes_rctd(void) } } +free_task: scsi_free_scsi_task(rso_task); }