From e66b50f8ec66c460d583d29f66871f48a2be19ac Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Tue, 20 May 2014 17:52:23 -0700 Subject: [PATCH] tests: use alloca when allocating scratch buffer for writesame Signed-off-by: Ronnie Sahlberg --- test-tool/test_writesame10_unmap_until_end.c | 3 +-- test-tool/test_writesame16_unmap.c | 3 +-- test-tool/test_writesame16_unmap_until_end.c | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/test-tool/test_writesame10_unmap_until_end.c b/test-tool/test_writesame10_unmap_until_end.c index c0b1801..a8a0f49 100644 --- a/test-tool/test_writesame10_unmap_until_end.c +++ b/test-tool/test_writesame10_unmap_until_end.c @@ -37,7 +37,7 @@ test_writesame10_unmap_until_end(void) CHECK_FOR_LBPWS10; CHECK_FOR_SBC; - zeroBlock = malloc(block_size); + zeroBlock = alloca(block_size); memset(zeroBlock, 0, block_size); logging(LOG_VERBOSE, LOG_BLANK_LINE); @@ -76,5 +76,4 @@ test_writesame10_unmap_until_end(void) } free(buf); } - free(zeroBlock); } diff --git a/test-tool/test_writesame16_unmap.c b/test-tool/test_writesame16_unmap.c index 08da0ed..202ad7d 100644 --- a/test-tool/test_writesame16_unmap.c +++ b/test-tool/test_writesame16_unmap.c @@ -41,7 +41,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); - zeroBlock = malloc(block_size); + zeroBlock = alloca(block_size); memset(zeroBlock, 0, block_size); for (i = 1; i <= 256; i++) { logging(LOG_VERBOSE, "Write %d blocks of 0xFF", i); @@ -246,5 +246,4 @@ test_writesame16_unmap(void) finished: free(buf); - free(zeroBlock); } diff --git a/test-tool/test_writesame16_unmap_until_end.c b/test-tool/test_writesame16_unmap_until_end.c index 369822c..71c2347 100644 --- a/test-tool/test_writesame16_unmap_until_end.c +++ b/test-tool/test_writesame16_unmap_until_end.c @@ -39,7 +39,7 @@ test_writesame16_unmap_until_end(void) CHECK_FOR_LBPWS; CHECK_FOR_SBC; - zeroBlock = malloc(block_size); + zeroBlock = alloca(block_size); memset(zeroBlock, 0, block_size); logging(LOG_VERBOSE, LOG_BLANK_LINE); @@ -79,5 +79,4 @@ test_writesame16_unmap_until_end(void) "and verify zero test"); } } - free(zeroBlock); }