From 0bb846c0f52822af60c284e82d38b293dc796f11 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sun, 2 Aug 2015 12:31:18 -0700 Subject: [PATCH] Don't use alloca for large blobs. Signed-off-by: Ronnie Sahlberg --- test-tool/test_extendedcopy_simple.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test-tool/test_extendedcopy_simple.c b/test-tool/test_extendedcopy_simple.c index 1bbc4f3..f40128a 100644 --- a/test-tool/test_extendedcopy_simple.c +++ b/test-tool/test_extendedcopy_simple.c @@ -33,8 +33,8 @@ test_extendedcopy_simple(void) int tgt_desc_len = 0, seg_desc_len = 0, offset = XCOPY_DESC_OFFSET; struct iscsi_data data; unsigned char *xcopybuf; - unsigned char *buf1 = alloca(2048*block_size); - unsigned char *buf2 = alloca(2048*block_size); + unsigned char *buf1 = malloc(2048*block_size); + unsigned char *buf2 = malloc(2048*block_size); logging(LOG_VERBOSE, LOG_BLANK_LINE); logging(LOG_VERBOSE, @@ -49,7 +49,7 @@ test_extendedcopy_simple(void) if (ret == -2) { logging(LOG_NORMAL, "[SKIPPED] WRITE16 is not implemented."); CU_PASS("WRITE16 is not implemented."); - return; + goto finished; } CU_ASSERT_EQUAL(ret, 0); @@ -77,7 +77,7 @@ test_extendedcopy_simple(void) if (ret == -2) { CU_PASS("[SKIPPED] Target does not support " "EXTENDED_COPY. Skipping test"); - return; + goto finished; } CU_ASSERT_EQUAL(ret, 0); @@ -90,4 +90,8 @@ test_extendedcopy_simple(void) ret = memcmp(buf1, buf2, 2048); if (ret != 0) CU_FAIL("Blocks were not copied correctly"); + + finished: + free(buf1); + free(buf2); }