summaryrefslogtreecommitdiffstats
path: root/usr.sbin/installboot/bootstrap.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin/installboot/bootstrap.c')
-rw-r--r--usr.sbin/installboot/bootstrap.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/usr.sbin/installboot/bootstrap.c b/usr.sbin/installboot/bootstrap.c
index 7e4f35b773d..48a2998ad00 100644
--- a/usr.sbin/installboot/bootstrap.c
+++ b/usr.sbin/installboot/bootstrap.c
@@ -68,10 +68,9 @@ bootstrap(int devfd, char *dev, char *bootfile)
fprintf(stderr, "bootstrap is %zu bytes "
"(%zu sectors @ %u bytes = %zu bytes)\n",
(ssize_t)sb.st_size, bootsec, dl.d_secsize, bootsize);
- boot = malloc(bootsize);
+ boot = calloc(1, bootsize);
if (boot == NULL)
- err(1, "malloc");
- memset(boot, 0, bootsize);
+ err(1, "calloc");
if (read(fd, boot, bootsize) != (ssize_t)sb.st_size)
err(1, "read");
close(fd);