summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.cz>2013-11-27 18:14:58 +0100
committerChris Mason <clm@fb.com>2014-01-31 08:22:07 -0800
commit37cd29521a01135335d0d0657829a182fa261a74 (patch)
tree921ac8ee522e9ba5310887d03c22062b32a8cae6
parent53ee1bccf99cd5b474fe1aa857b7dd176e3a1407 (diff)
btrfs-progs: call endmntent in btrfs_scan_kernel
btrfs_scan_kernel() does a getmntent() but never releases the filedescriptor it gets back from that. Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=64711 Reported-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
-rw-r--r--cmds-filesystem.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 8296fa1e..8e4754f8 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -449,11 +449,12 @@ static int btrfs_scan_kernel(void *search)
ret = get_fs_info(mnt->mnt_dir, &fs_info_arg,
&dev_info_arg);
if (ret)
- return ret;
+ goto out;
if (get_label_mounted(mnt->mnt_dir, label)) {
kfree(dev_info_arg);
- return 1;
+ ret = 1;
+ goto out;
}
if (search && !match_search_item_kernel(fs_info_arg.fsid,
mnt->mnt_dir, label, search)) {
@@ -472,11 +473,14 @@ static int btrfs_scan_kernel(void *search)
close(fd);
kfree(dev_info_arg);
if (search)
- return 0;
+ ret = 0;
}
if (search)
- return 1;
- return 0;
+ ret = 1;
+
+out:
+ endmntent(f);
+ return ret;
}
static const char * const cmd_show_usage[] = {