From b32111f8c12acc73d36d7ce64b0eb6e316f54762 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Sat, 1 Sep 2007 19:32:20 +0000 Subject: malloc(n * m) -> calloc(n, m); from zinovik --- bin/ps/ps.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/ps/ps.c b/bin/ps/ps.c index db576ae97cf..87274f1e2da 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ps.c,v 1.42 2006/11/01 19:07:18 jmc Exp $ */ +/* $OpenBSD: ps.c,v 1.43 2007/09/01 19:32:19 deraadt Exp $ */ /* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */ /*- @@ -40,7 +40,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94"; #else -static char rcsid[] = "$OpenBSD: ps.c,v 1.42 2006/11/01 19:07:18 jmc Exp $"; +static char rcsid[] = "$OpenBSD: ps.c,v 1.43 2007/09/01 19:32:19 deraadt Exp $"; #endif #endif /* not lint */ @@ -361,7 +361,7 @@ main(int argc, char *argv[]) * sort proc list, we convert from an array of structs to an array * of pointers to make the sort cheaper. */ - if ((kinfo = malloc(sizeof(*kinfo) * nentries)) == NULL) + if ((kinfo = calloc(sizeof(*kinfo), nentries)) == NULL) err(1, "failed to allocate memory for proc pointers"); for (i = 0; i < nentries; i++) kinfo[i] = &kp[i]; -- cgit v1.2.3