summaryrefslogtreecommitdiff
path: root/cmds-inspect.c
diff options
context:
space:
mode:
authorDavid Sterba <dsterba@suse.com>2015-11-06 17:47:17 +0100
committerDavid Sterba <dsterba@suse.com>2015-11-13 18:24:34 +0100
commitd7492ec59e2b0a7aa039aad8d77f9d0d701eac65 (patch)
tree0c9509a4db71b0981005623e77b1a55e0d81ec35 /cmds-inspect.c
parent5c132351e4c6831a941c1e453c2ad08ecd07a527 (diff)
btrfs-progs: use on-stack buffer in __ino_to_path_fd
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'cmds-inspect.c')
-rw-r--r--cmds-inspect.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/cmds-inspect.c b/cmds-inspect.c
index 40ab49b..c2bb862 100644
--- a/cmds-inspect.c
+++ b/cmds-inspect.c
@@ -42,15 +42,11 @@ static int __ino_to_path_fd(u64 inum, int fd, int verbose, const char *prepend)
int ret;
int i;
struct btrfs_ioctl_ino_path_args ipa;
- struct btrfs_data_container *fspath;
-
- fspath = malloc(4096);
- if (!fspath)
- return -ENOMEM;
+ struct btrfs_data_container fspath[PATH_MAX];
memset(fspath, 0, sizeof(*fspath));
ipa.inum = inum;
- ipa.size = 4096;
+ ipa.size = PATH_MAX;
ipa.fspath = ptr_to_u64(fspath);
ret = ioctl(fd, BTRFS_IOC_INO_PATHS, &ipa);
@@ -79,7 +75,6 @@ static int __ino_to_path_fd(u64 inum, int fd, int verbose, const char *prepend)
}
out:
- free(fspath);
return !!ret;
}