diff mbox

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

Message ID 8499af348407909801cf87c6e1e7426c930ae567.1419951036.git.dsterba@suse.cz (mailing list archive)
State Accepted
Headers show

Commit Message

David Sterba Dec. 30, 2014, 2:57 p.m. UTC
Resolves-coverity-id: 1260252
Signed-off-by: David Sterba <dsterba@suse.cz>
---
 cmds-filesystem.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox

Patch

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),