From 45562fb05a63e5f5a373d38e068a7e1100c92e7e Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Mon, 1 Dec 2014 15:06:53 -0800 Subject: vboot2: Use calloc() in host lib and unit tests This is cleaner than malloc() immediately followed by memset(). BUG=chromium:423882 BRANCH=none TEST=VBOOT2=1 make runtests Change-Id: Iac32ca54ba18ef6722c6e9c58d521d5337a816b2 Signed-off-by: Randall Spangler Reviewed-on: https://chromium-review.googlesource.com/232770 Reviewed-by: Bill Richardson --- tests/vb2_host_key_tests.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'tests/vb2_host_key_tests.c') diff --git a/tests/vb2_host_key_tests.c b/tests/vb2_host_key_tests.c index 5780691a..451366f7 100644 --- a/tests/vb2_host_key_tests.c +++ b/tests/vb2_host_key_tests.c @@ -187,8 +187,7 @@ static void public_key_tests(const struct alg_combo *combo, vb2_public_key_free(key); bufsize = vb2_packed_key_size(combo->sig_alg); - buf = malloc(bufsize); - memset(buf, 0, bufsize); + buf = calloc(1, bufsize); vb2_write_file(testfile, buf, bufsize - 1); TEST_EQ(vb2_public_key_read_keyb(&key, testfile), -- cgit v1.2.1