diff --git a/src/crypto.c b/src/crypto.c index 88de357d5d..99e9f08576 100644 --- a/src/crypto.c +++ b/src/crypto.c @@ -280,7 +280,7 @@ sign_bct(build_image_context *context, bct) != 0) return -ENODATA; - hash_buffer = malloc(hash_size); + hash_buffer = calloc(1, hash_size); if (hash_buffer == NULL) return -ENOMEM; e = sign_data_block(bct + Offset, length, hash_buffer); diff --git a/src/data_layout.c b/src/data_layout.c index ae6212683d..cae4c37da5 100644 --- a/src/data_layout.c +++ b/src/data_layout.c @@ -391,7 +391,7 @@ write_bootloaders(build_image_context *context) g_soc_config->get_value(token_bootloaders_max, &bootloaders_max, context->bct); - hash_buffer = malloc(hash_size); + hash_buffer = calloc(1, hash_size); if (hash_buffer == NULL) return -ENOMEM;