test tool, WRITESAME(16) UNMAP test: Avoid leaking 'buf' if a precondition fails

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
This commit is contained in:
Bart Van Assche
2013-10-21 11:52:57 +02:00
committed by Ronnie Sahlberg
parent 64e800a437
commit 9f89f220f5

View File

@@ -30,7 +30,7 @@ test_writesame16_unmap(void)
{
int i, ret;
unsigned int j;
unsigned char *buf = malloc(65536 * block_size);
unsigned char *buf;
CHECK_FOR_DATALOSS;
CHECK_FOR_THIN_PROVISIONING;
@@ -39,6 +39,7 @@ test_writesame16_unmap(void)
logging(LOG_VERBOSE, LOG_BLANK_LINE);
logging(LOG_VERBOSE, "Test WRITESAME16 of 1-256 blocks at the start of the LUN");
buf = malloc(65536 * block_size);
for (i = 1; i <= 256; i++) {
logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i);
memset(buf, 0xff, i * block_size);