summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sbin/growfs/growfs.c6
-rw-r--r--sbin/isakmpd/exchange.c5
-rw-r--r--usr.bin/dc/bcode.c8
-rw-r--r--usr.bin/ipcs/ipcs.c14
4 files changed, 16 insertions, 17 deletions
diff --git a/sbin/growfs/growfs.c b/sbin/growfs/growfs.c
index bb827808e98..096f5cb9533 100644
--- a/sbin/growfs/growfs.c
+++ b/sbin/growfs/growfs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: growfs.c,v 1.21 2007/07/07 08:22:55 millert Exp $ */
+/* $OpenBSD: growfs.c,v 1.22 2007/09/02 23:50:03 deraadt Exp $ */
/*
* Copyright (c) 2000 Christoph Herrmann, Thomas-Henning von Kamptz
* Copyright (c) 1980, 1989, 1993 The Regents of the University of California.
@@ -1241,10 +1241,10 @@ updcsloc(time_t utime, int fsi, int fso, unsigned int Nflag)
/*
* Allocate the space for the array of blocks to be relocated.
*/
- bp = (struct gfs_bpp *)malloc(((dupper-odupper) / sblock.fs_frag + 2) *
+ bp = (struct gfs_bpp *)calloc(((dupper-odupper) / sblock.fs_frag + 2),
sizeof(struct gfs_bpp));
if (bp == NULL)
- errx(1, "malloc failed");
+ errx(1, "calloc failed");
memset((char *)bp, 0, ((dupper-odupper) / sblock.fs_frag + 2) *
sizeof(struct gfs_bpp));
diff --git a/sbin/isakmpd/exchange.c b/sbin/isakmpd/exchange.c
index 39d6242d790..27f71a1aa6c 100644
--- a/sbin/isakmpd/exchange.c
+++ b/sbin/isakmpd/exchange.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: exchange.c,v 1.131 2007/08/05 09:43:09 tom Exp $ */
+/* $OpenBSD: exchange.c,v 1.132 2007/09/02 23:50:04 deraadt Exp $ */
/* $EOM: exchange.c,v 1.143 2000/12/04 00:02:25 angelos Exp $ */
/*
@@ -411,8 +411,7 @@ exchange_init(void)
int i;
bucket_mask = (1 << INITIAL_BUCKET_BITS) - 1;
- exchange_tab = malloc((bucket_mask + 1) *
- sizeof(struct exchange_list));
+ exchange_tab = calloc(bucket_mask + 1, sizeof(struct exchange_list));
if (!exchange_tab)
log_fatal("exchange_init: out of memory");
for (i = 0; i <= bucket_mask; i++)
diff --git a/usr.bin/dc/bcode.c b/usr.bin/dc/bcode.c
index 10a997a09c6..c693febb202 100644
--- a/usr.bin/dc/bcode.c
+++ b/usr.bin/dc/bcode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: bcode.c,v 1.34 2006/01/19 20:06:55 otto Exp $ */
+/* $OpenBSD: bcode.c,v 1.35 2007/09/02 23:50:04 deraadt Exp $ */
/*
* Copyright (c) 2003, Otto Moerbeek <otto@drijf.net>
@@ -17,7 +17,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: bcode.c,v 1.34 2006/01/19 20:06:55 otto Exp $";
+static const char rcsid[] = "$OpenBSD: bcode.c,v 1.35 2007/09/02 23:50:04 deraadt Exp $";
#endif /* not lint */
#include <ssl/ssl.h>
@@ -239,7 +239,7 @@ init_bmachine(bool extended_registers)
bmachine.reg_array_size = bmachine.extended_regs ?
REG_ARRAY_SIZE_BIG : REG_ARRAY_SIZE_SMALL;
- bmachine.reg = malloc(bmachine.reg_array_size *
+ bmachine.reg = calloc(bmachine.reg_array_size,
sizeof(bmachine.reg[0]));
if (bmachine.reg == NULL)
err(1, NULL);
@@ -255,7 +255,7 @@ init_bmachine(bool extended_registers)
stack_init(&bmachine.reg[i]);
bmachine.readstack_sz = READSTACK_SIZE;
- bmachine.readstack = malloc(sizeof(struct source) *
+ bmachine.readstack = calloc(sizeof(struct source),
bmachine.readstack_sz);
if (bmachine.readstack == NULL)
err(1, NULL);
diff --git a/usr.bin/ipcs/ipcs.c b/usr.bin/ipcs/ipcs.c
index 108d72df021..b08b0bc8605 100644
--- a/usr.bin/ipcs/ipcs.c
+++ b/usr.bin/ipcs/ipcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipcs.c,v 1.21 2005/02/22 14:47:45 jmc Exp $ */
+/* $OpenBSD: ipcs.c,v 1.22 2007/09/02 23:50:04 deraadt Exp $ */
/* $NetBSD: ipcs.c,v 1.25 2000/06/16 03:58:20 simonb Exp $ */
/*-
@@ -718,10 +718,10 @@ ipcs_kvm(void)
errx(1, "kvm_read (%s): %s",
symbols[X_MSQIDS].n_name, kvm_geterr(kd));
- msqids = malloc(sizeof(struct msqid_ds) *
+ msqids = calloc(sizeof(struct msqid_ds),
msginfo.msgmni);
if (msqids == NULL)
- err(1, "malloc");
+ err(1, "calloc");
if (kvm_read(kd, addr, msqids,
sizeof(struct msqid_ds) * msginfo.msgmni) !=
@@ -770,10 +770,10 @@ ipcs_kvm(void)
errx(1, "kvm_read (%s): %s",
symbols[X_SHMSEGS].n_name, kvm_geterr(kd));
- shmsegs = malloc(sizeof(struct shmid_ds *) *
+ shmsegs = calloc(sizeof(struct shmid_ds *),
shminfo.shmmni);
if (shmsegs == NULL)
- err(1, "malloc");
+ err(1, "calloc");
if (kvm_read(kd, addr, shmsegs,
sizeof(struct shmid_ds *) * shminfo.shmmni) !=
@@ -824,10 +824,10 @@ ipcs_kvm(void)
errx(1, "kvm_read (%s): %s",
symbols[X_SEMA].n_name, kvm_geterr(kd));
- sema = malloc(sizeof(struct semid_ds *) *
+ sema = calloc(sizeof(struct semid_ds *),
seminfo.semmni);
if (sema == NULL)
- err(1, "malloc");
+ err(1, "calloc");
if (kvm_read(kd, addr, sema,
sizeof(struct semid_ds *) * seminfo.semmni) !=