summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2014-05-25 17:47:04 +0000
committertedu <tedu@openbsd.org>2014-05-25 17:47:04 +0000
commitc74211650dcad548320eb0c4f22cfe8cab019176 (patch)
treea83a34be7f6a53952edaa8e8e8899282e0f2da90 /lib
parentone calloc from Benjamin Baier, one from me. (diff)
downloadwireguard-openbsd-c74211650dcad548320eb0c4f22cfe8cab019176.tar.xz
wireguard-openbsd-c74211650dcad548320eb0c4f22cfe8cab019176.zip
use calloc, from Benjamin Baier
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/auth_subr.c5
-rw-r--r--lib/libc/gen/fts.c5
-rw-r--r--lib/libc/locale/rune.c5
-rw-r--r--lib/libc/yp/yp_bind.c5
4 files changed, 8 insertions, 12 deletions
diff --git a/lib/libc/gen/auth_subr.c b/lib/libc/gen/auth_subr.c
index 5b385fbb6c7..398233d3f0a 100644
--- a/lib/libc/gen/auth_subr.c
+++ b/lib/libc/gen/auth_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth_subr.c,v 1.39 2013/11/24 23:51:29 deraadt Exp $ */
+/* $OpenBSD: auth_subr.c,v 1.40 2014/05/25 17:47:04 tedu Exp $ */
/*
* Copyright (c) 2000-2002,2004 Todd C. Miller <Todd.Miller@courtesan.com>
@@ -167,8 +167,7 @@ auth_open(void)
{
auth_session_t *as;
- if ((as = malloc(sizeof(auth_session_t))) != NULL) {
- memset(as, 0, sizeof(*as));
+ if ((as = calloc(1, sizeof(auth_session_t))) != NULL) {
as->service = defservice;
as->fd = -1;
}
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
index 8f4c3640b95..8d845436ea8 100644
--- a/lib/libc/gen/fts.c
+++ b/lib/libc/gen/fts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fts.c,v 1.45 2013/09/30 12:02:33 millert Exp $ */
+/* $OpenBSD: fts.c,v 1.46 2014/05/25 17:47:04 tedu Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -906,10 +906,9 @@ fts_alloc(FTS *sp, char *name, size_t namelen)
len = sizeof(FTSENT) + namelen;
if (!ISSET(FTS_NOSTAT))
len += sizeof(struct stat) + ALIGNBYTES;
- if ((p = malloc(len)) == NULL)
+ if ((p = calloc(1, len)) == NULL)
return (NULL);
- memset(p, 0, len);
p->fts_path = sp->fts_path;
p->fts_namelen = namelen;
p->fts_instr = FTS_NOINSTR;
diff --git a/lib/libc/locale/rune.c b/lib/libc/locale/rune.c
index 8b7a4632531..b99d7f6d642 100644
--- a/lib/libc/locale/rune.c
+++ b/lib/libc/locale/rune.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rune.c,v 1.3 2012/12/05 23:20:00 deraadt Exp $ */
+/* $OpenBSD: rune.c,v 1.4 2014/05/25 17:47:04 tedu Exp $ */
/* $NetBSD: rune.c,v 1.26 2004/05/09 11:26:33 kleink Exp $ */
/*-
@@ -230,9 +230,8 @@ _Read_RuneMagi(FILE *fp)
ntohl(frl.frl_maplower_ext.frr_nranges) * sizeof(_RuneEntry) +
ntohl(frl.frl_mapupper_ext.frr_nranges) * sizeof(_RuneEntry);
- if ((hostdata = malloc(hostdatalen)) == NULL)
+ if ((hostdata = calloc(hostdatalen, 1)) == NULL)
return NULL;
- memset(hostdata, 0, hostdatalen);
lastp = hostdata + hostdatalen;
rl = (_RuneLocale *)hostdata;
diff --git a/lib/libc/yp/yp_bind.c b/lib/libc/yp/yp_bind.c
index dc33bf28202..da9bf3f72e4 100644
--- a/lib/libc/yp/yp_bind.c
+++ b/lib/libc/yp/yp_bind.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: yp_bind.c,v 1.19 2013/09/30 12:02:36 millert Exp $ */
+/* $OpenBSD: yp_bind.c,v 1.20 2014/05/25 17:47:04 tedu Exp $ */
/*
* Copyright (c) 1992, 1993, 1996 Theo de Raadt <deraadt@theos.com>
* All rights reserved.
@@ -97,9 +97,8 @@ _yp_dobind(const char *dom, struct dom_binding **ypdb)
if (strcmp(dom, ysd->dom_domain) == 0)
break;
if (ysd == NULL) {
- if ((ysd = malloc(sizeof *ysd)) == NULL)
+ if ((ysd = calloc(1, sizeof *ysd)) == NULL)
return YPERR_RESRC;
- (void)memset(ysd, 0, sizeof *ysd);
ysd->dom_socket = -1;
ysd->dom_vers = 0;
new = 1;