summaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2013-12-12 13:05:50 -0500
committerTheodore Ts'o <tytso@mit.edu>2013-12-12 13:05:52 -0500
commite39082e2e81641eb8021eb6ddc969731537c79a8 (patch)
treefbf5a08994199cbbb8de4ce898273ded434aaad5 /misc
parentf0131bdc6ff2b349e84e4767d9fe8b078a0ee521 (diff)
downloade2fsprogs-e39082e2e81641eb8021eb6ddc969731537c79a8.tar.gz
misc: don't leak file descriptors (on error paths)
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'misc')
-rw-r--r--misc/e2image.c1
-rw-r--r--misc/filefrag.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/misc/e2image.c b/misc/e2image.c
index aa363fbc..d9e1db16 100644
--- a/misc/e2image.c
+++ b/misc/e2image.c
@@ -1229,6 +1229,7 @@ static void install_image(char *device, char *image_fn, int type)
exit(1);
}
+ close(fd);
ext2fs_close (fs);
}
diff --git a/misc/filefrag.c b/misc/filefrag.c
index 35b35441..a050a226 100644
--- a/misc/filefrag.c
+++ b/misc/filefrag.c
@@ -360,12 +360,14 @@ static void frag_report(const char *filename)
#else
if (fstat(fd, &st) < 0) {
#endif
+ close(fd);
perror("stat");
return;
}
if (last_device != st.st_dev) {
if (fstatfs(fd, &fsinfo) < 0) {
+ close(fd);
perror("fstatfs");
return;
}