From: tedu Date: Thu, 24 Apr 2014 01:34:35 +0000 (+0000) Subject: calloc is better. from Peter Malone X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=dd50e736fe80e7c3c8a31ea6c6656b3df9091766;p=openbsd calloc is better. from Peter Malone --- diff --git a/bin/cp/utils.c b/bin/cp/utils.c index dbe8cd14ee0..1a39ae783a2 100644 --- a/bin/cp/utils.c +++ b/bin/cp/utils.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utils.c,v 1.33 2012/07/11 16:19:24 matthew Exp $ */ +/* $OpenBSD: utils.c,v 1.34 2014/04/24 01:34:35 tedu Exp $ */ /* $NetBSD: utils.c,v 1.6 1997/02/26 14:40:51 cgd Exp $ */ /*- @@ -63,10 +63,9 @@ copy_file(FTSENT *entp, int dne) err(1, "malloc"); } if (!zeroes) { - zeroes = malloc(MAXBSIZE); + zeroes = calloc(1, MAXBSIZE); if (!zeroes) - err(1, "malloc"); - memset(zeroes, 0, MAXBSIZE); + err(1, "calloc"); } if ((from_fd = open(entp->fts_path, O_RDONLY, 0)) == -1) {