From 9f89f220f5b0495770ace3920efc2a2614de0564 Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Mon, 21 Oct 2013 11:52:57 +0200 Subject: [PATCH] test tool, WRITESAME(16) UNMAP test: Avoid leaking 'buf' if a precondition fails Signed-off-by: Bart Van Assche --- test-tool/test_writesame16_unmap.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test-tool/test_writesame16_unmap.c b/test-tool/test_writesame16_unmap.c index 3e3dfd9..206484f 100644 --- a/test-tool/test_writesame16_unmap.c +++ b/test-tool/test_writesame16_unmap.c @@ -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);