summaryrefslogtreecommitdiff
path: root/sbin/dmesg/dmesg.c
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2014-04-22 20:43:13 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2014-04-22 20:43:13 +0000
commit55cd190b9ae1013467b6b077d2fa6f39f0bbe4ba (patch)
treed8e539637b6206316da5393c0b90d976c3084edf /sbin/dmesg/dmesg.c
parentfae6b64b3fc55ed40f07782657756b4debce2842 (diff)
malloc/memset -> calloc. from peter malone
Diffstat (limited to 'sbin/dmesg/dmesg.c')
-rw-r--r--sbin/dmesg/dmesg.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/sbin/dmesg/dmesg.c b/sbin/dmesg/dmesg.c
index f9adf239c53..35fe2d81ef4 100644
--- a/sbin/dmesg/dmesg.c
+++ b/sbin/dmesg/dmesg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: dmesg.c,v 1.22 2010/07/02 22:02:06 deraadt Exp $ */
+/* $OpenBSD: dmesg.c,v 1.23 2014/04/22 20:43:12 tedu Exp $ */
/* $NetBSD: dmesg.c,v 1.8 1995/03/18 14:54:49 cgd Exp $ */
/*-
@@ -95,11 +95,10 @@ main(int argc, char *argv[])
err(1, "sysctl: KERN_MSGBUFSIZE");
msgbufsize += sizeof(struct msgbuf) - 1;
- bufdata = malloc(msgbufsize);
+ bufdata = calloc(1, msgbufsize);
if (bufdata == NULL)
errx(1, "couldn't allocate space for buffer data");
- memset(bufdata, 0, msgbufsize);
mib[1] = KERN_MSGBUF;
len = msgbufsize;
if (sysctl(mib, 2, bufdata, &len, NULL, 0))