[PATCH 2/5] btrfs-progs: fi show, don't leak canonical path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Resolves-coverity-id: 1260252
Signed-off-by: David Sterba <dsterba@xxxxxxx>
---
 cmds-filesystem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cmds-filesystem.c b/cmds-filesystem.c
index 80875fffddfe..1c1d34ae8ca2 100644
--- a/cmds-filesystem.c
+++ b/cmds-filesystem.c
@@ -471,7 +471,6 @@ static int print_one_fs(struct btrfs_ioctl_fs_info_args *fs_info,
 		char *canonical_path;
 
 		tmp_dev_info = (struct btrfs_ioctl_dev_info_args *)&dev_info[i];
-		canonical_path = canonicalize_path((char *)tmp_dev_info->path);
 
 		/* Add check for missing devices even mounted */
 		fd = open((char *)tmp_dev_info->path, O_RDONLY);
@@ -480,6 +479,7 @@ static int print_one_fs(struct btrfs_ioctl_fs_info_args *fs_info,
 			continue;
 		}
 		close(fd);
+		canonical_path = canonicalize_path((char *)tmp_dev_info->path);
 		printf("\tdevid %4llu size %s used %s path %s\n",
 			tmp_dev_info->devid,
 			pretty_size(tmp_dev_info->total_bytes),
-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux