From d73af2ac4bf2cbac9d73650b3e1fdc5b85204d58 Mon Sep 17 00:00:00 2001 From: Francesco Cosoleto Date: Tue, 8 Nov 2011 23:14:52 +0100 Subject: fsck.minix: remove unnecessary memset calls The program aborts without using this unintialized allocated memory, setting to zero doesn't look needed. memset calls with sizeof() of pointer as argument (reported by clang). [kzak@redhat.com: - replace malloc with calloc for {zone,inode}_count to make code more robust] Signed-off-by: Francesco Cosoleto Signed-off-by: Karel Zak --- disk-utils/fsck.minix.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'disk-utils/fsck.minix.c') diff --git a/disk-utils/fsck.minix.c b/disk-utils/fsck.minix.c index eb02f9ea6..ccbb7a970 100644 --- a/disk-utils/fsck.minix.c +++ b/disk-utils/fsck.minix.c @@ -611,15 +611,13 @@ read_tables(void) { zone_map = malloc(zmaps * MINIX_BLOCK_SIZE); if (!inode_map) die(_("Unable to allocate buffer for zone map")); - memset(inode_map,0,sizeof(inode_map)); - memset(zone_map,0,sizeof(zone_map)); inode_buffer = malloc(buffsz); if (!inode_buffer) die(_("Unable to allocate buffer for inodes")); - inode_count = malloc(inodes + 1); + inode_count = calloc(1, inodes + 1); if (!inode_count) die(_("Unable to allocate buffer for inode count")); - zone_count = malloc(zones); + zone_count = calloc(1, zones); if (!zone_count) die(_("Unable to allocate buffer for zone count")); -- cgit v1.2.3-55-g7522