Skip to content

Commit 9ff2f9f

Browse files
committed
misc: initialize memory before using in tests
valgrind complains about accessing not inialized data. Running test copy...==4327== Conditional jump or move depends on uninitialised value(s) ==4327== at 0x484E89E: bcmp (vg_replace_strmem.c:1234) ==4327== by 0x485D217: cmp (util.c:41) ==4327== by 0x485CE3C: ioctl (mock.c:188) ==4327== by 0x4870D1A: nvme_submit_passthru32 (ioctl.c:136) ==4327== by 0x4870EC3: nvme_submit_io_passthru (ioctl.c:183) ==4327== by 0x405595: test_copy (misc.c:1014) ==4327== by 0x406968: run_test (misc.c:1382) ==4327== by 0x406BF4: main (misc.c:1433) Signed-off-by: Daniel Wagner <[email protected]>
1 parent b1e49af commit 9ff2f9f

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

libnvme/test/ioctl/misc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -989,7 +989,7 @@ static void test_copy(void)
989989

990990
_cleanup_free_ struct nvme_copy_range *copy = NULL;
991991

992-
copy = malloc(copy_size);
992+
copy = calloc(1, copy_size);
993993
check(copy, "copy: ENOMEM");
994994

995995
struct mock_cmd mock_io_cmd = {

0 commit comments

Comments
 (0)