From: guenther Date: Tue, 22 Apr 2014 00:22:41 +0000 (+0000) Subject: Convert a malloc(x*y)+memset to calloc(x,y) X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=b6eef8d73367e47716d0d720466341a9d32a69f9;p=openbsd Convert a malloc(x*y)+memset to calloc(x,y) From Jean-Philippe Ouellet (jean-philippe (at) ouellet.biz) --- diff --git a/sbin/newfs_ext2fs/mke2fs.c b/sbin/newfs_ext2fs/mke2fs.c index 222eb0eab2c..9c2f0cd9bc7 100644 --- a/sbin/newfs_ext2fs/mke2fs.c +++ b/sbin/newfs_ext2fs/mke2fs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mke2fs.c,v 1.6 2013/12/27 19:17:28 deraadt Exp $ */ +/* $OpenBSD: mke2fs.c,v 1.7 2014/04/22 00:22:41 guenther Exp $ */ /* $NetBSD: mke2fs.c,v 1.13 2009/10/19 18:41:08 bouyer Exp $ */ /*- @@ -465,10 +465,9 @@ mke2fs(const char *fsys, int fi, int fo) /* * Initialize group descriptors */ - gd = malloc(sblock.e2fs_ngdb * bsize); + gd = calloc(sblock.e2fs_ngdb, bsize); if (gd == NULL) errx(EXIT_FAILURE, "Can't allocate descriptors buffer"); - memset(gd, 0, sblock.e2fs_ngdb * bsize); fbcount = 0; ficount = 0;