summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2007-09-03 14:26:54 +0000
committerderaadt <deraadt@openbsd.org>2007-09-03 14:26:54 +0000
commit7de199b689371aaca91a9e97807c0e3d78bd26e2 (patch)
tree008cda564c2c9c7d4dc1356cae21e1209fd68839
parentuse calloc() for the sake of regularity, prompted by deraadt@ (diff)
downloadwireguard-openbsd-7de199b689371aaca91a9e97807c0e3d78bd26e2.tar.xz
wireguard-openbsd-7de199b689371aaca91a9e97807c0e3d78bd26e2.zip
malloc(n * m) -> calloc(n, m); ok espie
-rw-r--r--bin/ed/glbl.c6
-rw-r--r--lib/libusbhid/usage.c4
-rw-r--r--sbin/init/init.c6
-rw-r--r--usr.sbin/pppoe/client.c4
-rw-r--r--usr.sbin/pppoe/server.c4
-rw-r--r--usr.sbin/pstat/pstat.c8
6 files changed, 16 insertions, 16 deletions
diff --git a/bin/ed/glbl.c b/bin/ed/glbl.c
index 8e9a5ea5734..d7862a31fd2 100644
--- a/bin/ed/glbl.c
+++ b/bin/ed/glbl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: glbl.c,v 1.10 2003/06/11 23:42:12 deraadt Exp $ */
+/* $OpenBSD: glbl.c,v 1.11 2007/09/03 14:26:54 deraadt Exp $ */
/* $NetBSD: glbl.c,v 1.2 1995/03/21 09:04:41 cgd Exp $ */
/* glob.c: This file contains the global command routines for the ed line
@@ -33,7 +33,7 @@
#if 0
static char *rcsid = "@(#)glob.c,v 1.1 1994/02/01 00:34:40 alm Exp";
#else
-static char rcsid[] = "$OpenBSD: glbl.c,v 1.10 2003/06/11 23:42:12 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: glbl.c,v 1.11 2007/09/03 14:26:54 deraadt Exp $";
#endif
#endif /* not lint */
@@ -169,7 +169,7 @@ set_active_node(line_t *lp)
}
#if defined(sun) || defined(NO_REALLOC_NULL)
} else {
- if ((ts = (line_t **) malloc((ti += MINBUFSZ) *
+ if ((ts = (line_t **) calloc(ti += MINBUFSZ,
sizeof(line_t **))) == NULL) {
perror(NULL);
seterrmsg("out of memory");
diff --git a/lib/libusbhid/usage.c b/lib/libusbhid/usage.c
index 6dc8718477a..228dbb74c47 100644
--- a/lib/libusbhid/usage.c
+++ b/lib/libusbhid/usage.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: usage.c,v 1.12 2007/03/20 03:42:52 tedu Exp $ */
+/* $OpenBSD: usage.c,v 1.13 2007/09/03 14:26:54 deraadt Exp $ */
/* $NetBSD: usage.c,v 1.1 2001/12/28 17:45:27 augustss Exp $ */
/*
@@ -173,7 +173,7 @@ hid_start(const char *hidname)
curpage->usage = no;
curpage->pagesize = 0;
curpage->pagesizemax = 10;
- curpage->page_contents = malloc(curpage->pagesizemax *
+ curpage->page_contents = calloc(curpage->pagesizemax,
sizeof (struct usage_in_page));
if (!curpage->page_contents)
goto fail;
diff --git a/sbin/init/init.c b/sbin/init/init.c
index 127813ac7e2..8c61f2aea0e 100644
--- a/sbin/init/init.c
+++ b/sbin/init/init.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: init.c,v 1.39 2006/06/22 00:25:22 deraadt Exp $ */
+/* $OpenBSD: init.c,v 1.40 2007/09/03 14:26:54 deraadt Exp $ */
/* $NetBSD: init.c,v 1.22 1996/05/15 23:29:33 jtc Exp $ */
/*-
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)init.c 8.2 (Berkeley) 4/28/95";
#else
-static char rcsid[] = "$OpenBSD: init.c,v 1.39 2006/06/22 00:25:22 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: init.c,v 1.40 2007/09/03 14:26:54 deraadt Exp $";
#endif
#endif /* not lint */
@@ -824,7 +824,7 @@ char **
construct_argv(char *command)
{
int argc = 0;
- char **argv = (char **) malloc(((strlen(command) + 1) / 2 + 1) *
+ char **argv = (char **) calloc((strlen(command) + 1) / 2 + 1,
sizeof (char *));
static const char separators[] = " \t";
diff --git a/usr.sbin/pppoe/client.c b/usr.sbin/pppoe/client.c
index 689a5078ec4..950d5ed84e1 100644
--- a/usr.sbin/pppoe/client.c
+++ b/usr.sbin/pppoe/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.20 2004/09/03 06:37:14 tedu Exp $ */
+/* $OpenBSD: client.c,v 1.21 2007/09/03 14:26:54 deraadt Exp $ */
/*
* Copyright (c) 2000 Network Security Technologies, Inc. http://www.netsec.net
@@ -100,7 +100,7 @@ client_mode(int bfd, u_int8_t *sysname, u_int8_t *srvname, struct ether_addr *my
if (max > oldmax) {
if (fdsp != NULL)
free(fdsp);
- fdsp = (fd_set *)malloc(howmany(max, NFDBITS) *
+ fdsp = (fd_set *)calloc(howmany(max, NFDBITS),
sizeof(fd_mask));
if (fdsp == NULL) {
r = -1;
diff --git a/usr.sbin/pppoe/server.c b/usr.sbin/pppoe/server.c
index 87067ebcddd..73f85e1bf63 100644
--- a/usr.sbin/pppoe/server.c
+++ b/usr.sbin/pppoe/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.12 2004/05/06 20:29:04 deraadt Exp $ */
+/* $OpenBSD: server.c,v 1.13 2007/09/03 14:26:54 deraadt Exp $ */
/*
* Copyright (c) 2000 Network Security Technologies, Inc. http://www.netsec.net
@@ -93,7 +93,7 @@ server_mode(int bpffd, u_int8_t *sysname, u_int8_t *srvname,
if (n > oldmax) {
if (fdsp != NULL)
free(fdsp);
- fdsp = (fd_set *)malloc(howmany(n, NFDBITS) *
+ fdsp = (fd_set *)calloc(howmany(n, NFDBITS),
sizeof(fd_mask));
if (fdsp == NULL)
break;
diff --git a/usr.sbin/pstat/pstat.c b/usr.sbin/pstat/pstat.c
index fb1aefe54d4..04141890214 100644
--- a/usr.sbin/pstat/pstat.c
+++ b/usr.sbin/pstat/pstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pstat.c,v 1.65 2007/09/02 15:19:40 deraadt Exp $ */
+/* $OpenBSD: pstat.c,v 1.66 2007/09/03 14:26:54 deraadt Exp $ */
/* $NetBSD: pstat.c,v 1.27 1996/10/23 22:50:06 cgd Exp $ */
/*-
@@ -40,7 +40,7 @@ static char copyright[] =
#if 0
from: static char sccsid[] = "@(#)pstat.c 8.9 (Berkeley) 2/16/94";
#else
-static char *rcsid = "$OpenBSD: pstat.c,v 1.65 2007/09/02 15:19:40 deraadt Exp $";
+static char *rcsid = "$OpenBSD: pstat.c,v 1.66 2007/09/03 14:26:54 deraadt Exp $";
#endif
#endif /* not lint */
@@ -716,8 +716,8 @@ kinfo_vnodes(int *avnodes)
err(1, "sysctl(KERN_NUMVNODES) failed");
} else
KGET(V_NUMV, numvnodes);
- if ((vbuf = malloc((numvnodes + 20) *
- (sizeof(struct vnode *) + sizeof(struct vnode)))) == NULL)
+ if ((vbuf = calloc(numvnodes + 20,
+ sizeof(struct vnode *) + sizeof(struct vnode))) == NULL)
err(1, "malloc: vnode buffer");
bp = vbuf;
evbuf = vbuf + (numvnodes + 20) *