From b6eef8d73367e47716d0d720466341a9d32a69f9 Mon Sep 17 00:00:00 2001 From: guenther Date: Tue, 22 Apr 2014 00:22:41 +0000 Subject: [PATCH] Convert a malloc(x*y)+memset to calloc(x,y) From Jean-Philippe Ouellet (jean-philippe (at) ouellet.biz) --- sbin/newfs_ext2fs/mke2fs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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; -- 2.20.1