summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-02-08 19:02:24 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-02-08 19:02:24 +0000
commitaec6820f764bce0a08e7fbaae18c355397be975d (patch)
tree169b7f83e88f841300ec9d96a84a148c3b622cef
parent80ab6fb5c69fe4980292f75b60af96901b22d6f8 (diff)
Plug some mem leaks that occur when checking multiple file systems in a
row. ok beck@ pedro@ millert@
-rw-r--r--sbin/fsck_ffs/fsck.h3
-rw-r--r--sbin/fsck_ffs/main.c10
-rw-r--r--sbin/fsck_ffs/setup.c5
3 files changed, 12 insertions, 6 deletions
diff --git a/sbin/fsck_ffs/fsck.h b/sbin/fsck_ffs/fsck.h
index cbcded0882e..6cbd5d9c50e 100644
--- a/sbin/fsck_ffs/fsck.h
+++ b/sbin/fsck_ffs/fsck.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsck.h,v 1.16 2006/03/22 20:24:32 deraadt Exp $ */
+/* $OpenBSD: fsck.h,v 1.17 2007/02/08 19:02:23 otto Exp $ */
/* $NetBSD: fsck.h,v 1.13 1996/10/11 20:15:46 thorpej Exp $ */
/*
@@ -73,6 +73,7 @@ struct bufarea {
#define MINBUFS 5 /* minimum number of buffers required */
struct bufarea bufhead; /* head of list of other blks in filesys */
struct bufarea sblk; /* file system superblock */
+struct bufarea asblk; /* alternate file system superblock */
struct bufarea cgblk; /* cylinder group blocks */
struct bufarea *pdirbp; /* current directory contents */
struct bufarea *pbp; /* current inode block */
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c
index 327c0c6e20e..989a0de1789 100644
--- a/sbin/fsck_ffs/main.c
+++ b/sbin/fsck_ffs/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.27 2006/04/17 09:34:16 moritz Exp $ */
+/* $OpenBSD: main.c,v 1.28 2007/02/08 19:02:23 otto Exp $ */
/* $NetBSD: main.c,v 1.22 1996/10/11 20:15:48 thorpej Exp $ */
/*
@@ -40,7 +40,7 @@ static const char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 1/23/94";
#else
-static const char rcsid[] = "$OpenBSD: main.c,v 1.27 2006/04/17 09:34:16 moritz Exp $";
+static const char rcsid[] = "$OpenBSD: main.c,v 1.28 2007/02/08 19:02:23 otto Exp $";
#endif
#endif /* not lint */
@@ -309,8 +309,14 @@ checkfilesys(char *filesys, char *mntpt, long auxdata, int child)
blockmap = NULL;
free(statemap);
statemap = NULL;
+ free(typemap);
+ typemap = NULL;
free(lncntp);
lncntp = NULL;
+ free(sblock.fs_csp);
+ free(sblk.b_un.b_buf);
+ free(asblk.b_un.b_buf);
+
if (!fsmodified)
return (0);
if (!preen)
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index 0689fdd02ae..cfedf438988 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: setup.c,v 1.24 2006/04/17 19:18:08 deraadt Exp $ */
+/* $OpenBSD: setup.c,v 1.25 2007/02/08 19:02:23 otto Exp $ */
/* $NetBSD: setup.c,v 1.27 1996/09/27 22:45:19 christos Exp $ */
/*
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)setup.c 8.5 (Berkeley) 11/23/94";
#else
-static const char rcsid[] = "$OpenBSD: setup.c,v 1.24 2006/04/17 19:18:08 deraadt Exp $";
+static const char rcsid[] = "$OpenBSD: setup.c,v 1.25 2007/02/08 19:02:23 otto Exp $";
#endif
#endif /* not lint */
@@ -58,7 +58,6 @@ static const char rcsid[] = "$OpenBSD: setup.c,v 1.24 2006/04/17 19:18:08 deraad
#include "extern.h"
#include "fsutil.h"
-struct bufarea asblk;
#define altsblock (*asblk.b_un.b_fs)
#define POWEROF2(num) (((num) & ((num) - 1)) == 0)