summaryrefslogtreecommitdiff
path: root/tests/vb2_common_tests.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2014-12-01 15:06:53 -0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-12-03 21:29:22 +0000
commit45562fb05a63e5f5a373d38e068a7e1100c92e7e (patch)
tree2d7caaf8fc9ee33c2bd91e51669d358fcb316ad2 /tests/vb2_common_tests.c
parent42a850059ca07f5e14fdf31990a35ad63e3f1bd8 (diff)
downloadvboot-45562fb05a63e5f5a373d38e068a7e1100c92e7e.tar.gz
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 <rspangler@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/232770 Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'tests/vb2_common_tests.c')
-rw-r--r--tests/vb2_common_tests.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/tests/vb2_common_tests.c b/tests/vb2_common_tests.c
index 199b1e05..89c8307d 100644
--- a/tests/vb2_common_tests.c
+++ b/tests/vb2_common_tests.c
@@ -665,8 +665,7 @@ static void test_verify_fw_preamble(void)
/* Now that the total size is known, create the real preamble */
buf_size = fp.c.total_size;
- buf = malloc(buf_size);
- memset(buf, 0, buf_size);
+ buf = calloc(1, buf_size);
memcpy(buf, &fp, sizeof(fp));
memcpy(buf + fp.c.fixed_size, desc, sizeof(desc));