diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2006-04-02 21:38:58 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2006-04-02 21:38:58 +0000 |
commit | 5b14fea36497511e6428b2c588513d92bc92cb90 (patch) | |
tree | 0b66759932d131cfb42148e0672334d215e6b99f /sbin/fsck_msdos | |
parent | ba37f6b6fd488dbe7dd7be429e8b7a994a783155 (diff) |
malloc(x * y) -> calloc(x, y) from adobriyan AT gmail.com, with tweaks
suggested by kjell@; ok otto@ pat@ millert@ jaredy@
Diffstat (limited to 'sbin/fsck_msdos')
-rw-r--r-- | sbin/fsck_msdos/fat.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/sbin/fsck_msdos/fat.c b/sbin/fsck_msdos/fat.c index 637624b8f9a..b81c3188fbc 100644 --- a/sbin/fsck_msdos/fat.c +++ b/sbin/fsck_msdos/fat.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fat.c,v 1.13 2006/03/20 20:11:02 dhill Exp $ */ +/* $OpenBSD: fat.c,v 1.14 2006/04/02 21:38:56 djm Exp $ */ /* $NetBSD: fat.c,v 1.8 1997/10/17 11:19:53 ws Exp $ */ /* @@ -35,7 +35,7 @@ #ifndef lint -static char rcsid[] = "$OpenBSD: fat.c,v 1.13 2006/03/20 20:11:02 dhill Exp $"; +static char rcsid[] = "$OpenBSD: fat.c,v 1.14 2006/04/02 21:38:56 djm Exp $"; #endif /* not lint */ #include <stdlib.h> @@ -94,7 +94,7 @@ readfat(int fs, struct bootblock *boot, int no, struct fatEntry **fp) int ret = FSOK; boot->NumFree = boot->NumBad = 0; - fat = malloc(sizeof(struct fatEntry) * boot->NumClusters); + fat = calloc(boot->NumClusters, sizeof(struct fatEntry)); buffer = malloc(boot->FATsecs * boot->BytesPerSec); if (fat == NULL || buffer == NULL) { perror("No space for FAT"); @@ -103,8 +103,6 @@ readfat(int fs, struct bootblock *boot, int no, struct fatEntry **fp) return (FSFATAL); } - (void)memset(fat, 0, sizeof(struct fatEntry) * boot->NumClusters); - off = boot->ResSectors + no * boot->FATsecs; off *= boot->BytesPerSec; |