diff options
author | David Hill <dhill@cvs.openbsd.org> | 2006-03-20 20:00:06 +0000 |
---|---|---|
committer | David Hill <dhill@cvs.openbsd.org> | 2006-03-20 20:00:06 +0000 |
commit | 43176755fa5c6de09296b9117308040713428bd3 (patch) | |
tree | c152d26b6d6775720a5973757bc3079b283c64e4 | |
parent | c9e0f1dc8cbeafd7ea99d866a2d0583c3587d61c (diff) |
NetBSD Coverity CID 2074: Fix memory leak.
ok deraadt@
-rw-r--r-- | sbin/fsck_ffs/utilities.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sbin/fsck_ffs/utilities.c b/sbin/fsck_ffs/utilities.c index 735552163f8..ae7406f1cf6 100644 --- a/sbin/fsck_ffs/utilities.c +++ b/sbin/fsck_ffs/utilities.c @@ -1,4 +1,4 @@ -/* $OpenBSD: utilities.c,v 1.22 2006/03/12 02:28:28 deraadt Exp $ */ +/* $OpenBSD: utilities.c,v 1.23 2006/03/20 20:00:05 dhill Exp $ */ /* $NetBSD: utilities.c,v 1.18 1996/09/27 22:45:20 christos Exp $ */ /* @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)utilities.c 8.1 (Berkeley) 6/5/93"; #else -static const char rcsid[] = "$OpenBSD: utilities.c,v 1.22 2006/03/12 02:28:28 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: utilities.c,v 1.23 2006/03/20 20:00:05 dhill Exp $"; #endif #endif /* not lint */ @@ -144,8 +144,12 @@ bufinit(void) bp = malloc(sizeof(struct bufarea)); bufp = malloc((unsigned int)sblock.fs_bsize); if (bp == NULL || bufp == NULL) { - if (i >= MINBUFS) + if (i >= MINBUFS) { + free(bp); + free(bufp); + break; + } errexit("cannot allocate buffer pool\n"); } bp->b_un.b_buf = bufp; |