Merge pull request #305 from bvanassche/master
Use dynamic memory allocation instead of variable-length arrays
This commit is contained in:
@@ -93,7 +93,7 @@ test_async_lu_reset_simple(void)
|
||||
struct tests_async_reset_state state = { NULL, 0, 0, 0, };
|
||||
int blocksize = 512;
|
||||
int blocks_per_io = 8;
|
||||
unsigned char buf[blocksize * blocks_per_io];
|
||||
unsigned char *buf;
|
||||
uint64_t timeout_sec;
|
||||
|
||||
CHECK_FOR_DATALOSS;
|
||||
@@ -106,7 +106,10 @@ test_async_lu_reset_simple(void)
|
||||
return;
|
||||
}
|
||||
|
||||
memset(buf, 0, blocksize * blocks_per_io);
|
||||
buf = calloc(blocksize, blocks_per_io);
|
||||
CU_ASSERT(buf != NULL);
|
||||
if (!buf)
|
||||
return;
|
||||
|
||||
/* queue and dispatch write before the reset */
|
||||
state.wtask = scsi_cdb_write10(0, blocks_per_io * blocksize,
|
||||
@@ -202,4 +205,6 @@ out:
|
||||
iscsi_destroy_context(sd->iscsi_ctx);
|
||||
scsi_free_scsi_task(state.wtask);
|
||||
sd->iscsi_ctx = NULL;
|
||||
|
||||
free(buf);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user