diff options
author | 2014-06-09 13:13:48 +0000 | |
---|---|---|
committer | 2014-06-09 13:13:48 +0000 | |
commit | 210008b3130591ff79d2d5024ffeaba6feea47ff (patch) | |
tree | 70f086223637682b9fabcc0405785eb6ab04ab26 /usr.sbin/installboot/bootstrap.c | |
parent | Split the 88100 floating point support code in two files, one for the precise (diff) | |
download | wireguard-openbsd-210008b3130591ff79d2d5024ffeaba6feea47ff.tar.xz wireguard-openbsd-210008b3130591ff79d2d5024ffeaba6feea47ff.zip |
Use calloc() instead of malloc()/memset().
From Benjamin Baier.
Diffstat (limited to 'usr.sbin/installboot/bootstrap.c')
-rw-r--r-- | usr.sbin/installboot/bootstrap.c | 5 |
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); |