test-tool/*_dpofua: Fix memory leaks in error paths

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
This commit is contained in:
Bart Van Assche
2015-10-06 15:18:46 -07:00
committed by Ronnie Sahlberg
parent e9536d3333
commit 9ab1cc8baa
18 changed files with 62 additions and 40 deletions

View File

@@ -123,7 +123,7 @@ test_compareandwrite_dpofua(void)
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. " logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test"); "Skipping this part of the test");
return; goto out;
} }
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -152,5 +152,7 @@ test_compareandwrite_dpofua(void)
CU_FAIL("Target did not return any data for " CU_FAIL("Target did not return any data for "
"ReportSupportedOpcodes"); "ReportSupportedOpcodes");
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -120,7 +120,7 @@ test_orwrite_dpofua(void)
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. " logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test"); "Skipping this part of the test");
return; goto out;
} }
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -149,5 +149,7 @@ test_orwrite_dpofua(void)
CU_FAIL("Target did not return any data for " CU_FAIL("Target did not return any data for "
"ReportSupportedOpcodes"); "ReportSupportedOpcodes");
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -108,7 +108,7 @@ test_read10_dpofua(void)
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. " logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test"); "Skipping this part of the test");
return; goto out;
} }
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -137,5 +137,7 @@ test_read10_dpofua(void)
CU_FAIL("Target did not return any data for " CU_FAIL("Target did not return any data for "
"ReportSupportedOpcodes"); "ReportSupportedOpcodes");
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -107,7 +107,7 @@ test_read12_dpofua(void)
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. " logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test"); "Skipping this part of the test");
return; goto out;
} }
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -136,5 +136,7 @@ test_read12_dpofua(void)
CU_FAIL("Target did not return any data for " CU_FAIL("Target did not return any data for "
"ReportSupportedOpcodes"); "ReportSupportedOpcodes");
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -108,7 +108,7 @@ test_read16_dpofua(void)
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. " logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test"); "Skipping this part of the test");
return; goto out;
} }
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -137,5 +137,7 @@ test_read16_dpofua(void)
CU_FAIL("Target did not return any data for " CU_FAIL("Target did not return any data for "
"ReportSupportedOpcodes"); "ReportSupportedOpcodes");
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -47,14 +47,11 @@ test_report_supported_opcodes_one_command(void)
logging(LOG_NORMAL, "[SKIPPED] READ_SUPPORTED_OPCODES is not " logging(LOG_NORMAL, "[SKIPPED] READ_SUPPORTED_OPCODES is not "
"implemented."); "implemented.");
CU_PASS("READ_SUPPORTED_OPCODES is not implemented."); CU_PASS("READ_SUPPORTED_OPCODES is not implemented.");
scsi_free_scsi_task(rso_task); goto out;
return;
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
if (ret != 0) { if (ret != 0)
scsi_free_scsi_task(rso_task); goto out;
return;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -64,7 +61,7 @@ test_report_supported_opcodes_one_command(void)
"for ReportSupportedOpcodes\n"); "for ReportSupportedOpcodes\n");
CU_FAIL("Target did not return any data for " CU_FAIL("Target did not return any data for "
"ReportSupportedOpcodes"); "ReportSupportedOpcodes");
return; goto out;
} }
logging(LOG_VERBOSE, "Verify read one-command works for all supported " logging(LOG_VERBOSE, "Verify read one-command works for all supported "
@@ -200,6 +197,6 @@ test_report_supported_opcodes_one_command(void)
scsi_free_scsi_task(one_task); scsi_free_scsi_task(one_task);
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -47,14 +47,11 @@ test_report_supported_opcodes_rctd(void)
logging(LOG_NORMAL, "[SKIPPED] READ_SUPPORTED_OPCODES is not " logging(LOG_NORMAL, "[SKIPPED] READ_SUPPORTED_OPCODES is not "
"implemented."); "implemented.");
CU_PASS("READ_SUPPORTED_OPCODES is not implemented."); CU_PASS("READ_SUPPORTED_OPCODES is not implemented.");
scsi_free_scsi_task(rso_task); goto out;
return;
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
if (ret != 0) { if (ret != 0)
scsi_free_scsi_task(rso_task); goto out;
return;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -64,7 +61,7 @@ test_report_supported_opcodes_rctd(void)
"for ReportSupportedOpcodes\n"); "for ReportSupportedOpcodes\n");
CU_FAIL("Target did not return any data for " CU_FAIL("Target did not return any data for "
"ReportSupportedOpcodes"); "ReportSupportedOpcodes");
return; goto out;
} }
logging(LOG_VERBOSE, "Verify that all returned command descriptors " logging(LOG_VERBOSE, "Verify that all returned command descriptors "
@@ -89,9 +86,8 @@ test_report_supported_opcodes_rctd(void)
65535, 65535,
EXPECT_STATUS_GOOD); EXPECT_STATUS_GOOD);
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
if (ret != 0) { if (ret != 0)
return; goto out;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -120,5 +116,6 @@ test_report_supported_opcodes_rctd(void)
} }
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -45,14 +45,11 @@ test_report_supported_opcodes_servactv(void)
logging(LOG_NORMAL, "[SKIPPED] READ_SUPPORTED_OPCODES is not " logging(LOG_NORMAL, "[SKIPPED] READ_SUPPORTED_OPCODES is not "
"implemented."); "implemented.");
CU_PASS("READ_SUPPORTED_OPCODES is not implemented."); CU_PASS("READ_SUPPORTED_OPCODES is not implemented.");
scsi_free_scsi_task(rso_task); goto out;
return;
} }
CU_ASSERT_EQUAL(ret, 0); CU_ASSERT_EQUAL(ret, 0);
if (ret != 0) { if (ret != 0)
scsi_free_scsi_task(rso_task); goto out;
return;
}
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -62,7 +59,7 @@ test_report_supported_opcodes_servactv(void)
"for ReportSupportedOpcodes\n"); "for ReportSupportedOpcodes\n");
CU_FAIL("Target did not return any data for " CU_FAIL("Target did not return any data for "
"ReportSupportedOpcodes"); "ReportSupportedOpcodes");
return; goto out;
} }
@@ -77,5 +74,6 @@ test_report_supported_opcodes_servactv(void)
} }
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -97,7 +97,7 @@ test_verify10_dpo(void)
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. " logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test"); "Skipping this part of the test");
return; goto out;
} }
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -112,5 +112,7 @@ test_verify10_dpo(void)
"flag is clear in the CDB_USAGE_DATA"); "flag is clear in the CDB_USAGE_DATA");
CU_ASSERT_EQUAL(usage_data_dpo, 0x00); CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -97,7 +97,7 @@ test_verify12_dpo(void)
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. " logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test"); "Skipping this part of the test");
return; goto out;
} }
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -112,5 +112,7 @@ test_verify12_dpo(void)
"flag is clear in the CDB_USAGE_DATA"); "flag is clear in the CDB_USAGE_DATA");
CU_ASSERT_EQUAL(usage_data_dpo, 0x00); CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -97,7 +97,7 @@ test_verify16_dpo(void)
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. " logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test"); "Skipping this part of the test");
return; goto out;
} }
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -112,5 +112,7 @@ test_verify16_dpo(void)
"flag is clear in the CDB_USAGE_DATA"); "flag is clear in the CDB_USAGE_DATA");
CU_ASSERT_EQUAL(usage_data_dpo, 0x00); CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -111,7 +111,7 @@ test_write10_dpofua(void)
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. " logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test"); "Skipping this part of the test");
return; goto out;
} }
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -140,5 +140,7 @@ test_write10_dpofua(void)
CU_FAIL("Target did not return any data for " CU_FAIL("Target did not return any data for "
"ReportSupportedOpcodes"); "ReportSupportedOpcodes");
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -121,7 +121,7 @@ test_write12_dpofua(void)
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. " logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test"); "Skipping this part of the test");
return; goto out;
} }
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -150,5 +150,7 @@ test_write12_dpofua(void)
CU_FAIL("Target did not return any data for " CU_FAIL("Target did not return any data for "
"ReportSupportedOpcodes"); "ReportSupportedOpcodes");
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -121,7 +121,7 @@ test_write16_dpofua(void)
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. " logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test"); "Skipping this part of the test");
return; goto out;
} }
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -150,5 +150,7 @@ test_write16_dpofua(void)
CU_FAIL("Target did not return any data for " CU_FAIL("Target did not return any data for "
"ReportSupportedOpcodes"); "ReportSupportedOpcodes");
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -129,7 +129,7 @@ test_writeatomic16_dpofua(void)
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. " logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test"); "Skipping this part of the test");
return; goto out;
} }
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -158,5 +158,7 @@ test_writeatomic16_dpofua(void)
CU_FAIL("Target did not return any data for " CU_FAIL("Target did not return any data for "
"ReportSupportedOpcodes"); "ReportSupportedOpcodes");
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -97,7 +97,7 @@ test_writeverify10_dpo(void)
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. " logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test"); "Skipping this part of the test");
return; goto out;
} }
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -112,5 +112,7 @@ test_writeverify10_dpo(void)
"flag is clear in the CDB_USAGE_DATA"); "flag is clear in the CDB_USAGE_DATA");
CU_ASSERT_EQUAL(usage_data_dpo, 0x00); CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -97,7 +97,7 @@ test_writeverify12_dpo(void)
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. " logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test"); "Skipping this part of the test");
return; goto out;
} }
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -112,5 +112,7 @@ test_writeverify12_dpo(void)
"flag is clear in the CDB_USAGE_DATA"); "flag is clear in the CDB_USAGE_DATA");
CU_ASSERT_EQUAL(usage_data_dpo, 0x00); CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }

View File

@@ -99,7 +99,7 @@ test_writeverify16_dpo(void)
if (ret == -2) { if (ret == -2) {
logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. " logging(LOG_NORMAL, "REPORT_SUPPORTED_OPCODES not implemented. "
"Skipping this part of the test"); "Skipping this part of the test");
return; goto out;
} }
logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer"); logging(LOG_VERBOSE, "Unmarshall the DATA-IN buffer");
rsoc = scsi_datain_unmarshall(rso_task); rsoc = scsi_datain_unmarshall(rso_task);
@@ -114,5 +114,7 @@ test_writeverify16_dpo(void)
"flag is clear in the CDB_USAGE_DATA"); "flag is clear in the CDB_USAGE_DATA");
CU_ASSERT_EQUAL(usage_data_dpo, 0x00); CU_ASSERT_EQUAL(usage_data_dpo, 0x00);
} }
out:
scsi_free_scsi_task(rso_task); scsi_free_scsi_task(rso_task);
} }