u64 subvol_id;
int ret;
char *dest_dir_full_path;
- char *root_subvol_path;
+ char root_subvol_path[PATH_MAX];
int end = 0;
dest_dir_full_path = realpath(tomnt, NULL);
goto out;
}
- root_subvol_path = malloc(PATH_MAX);
- if (!root_subvol_path) {
- ret = -ENOMEM;
- fprintf(stderr, "ERROR: couldn't allocate buffer for the root "
- "subvol path\n");
- goto out;
- }
-
+ root_subvol_path[0] = 0;
ret = btrfs_subvolid_resolve(r->mnt_fd, root_subvol_path,
PATH_MAX, subvol_id);
if (ret) {
*/
if (strlen(root_subvol_path))
r->full_root_path = root_subvol_path;
- else
- free(root_subvol_path);
if (r->dest_dir_chroot) {
if (chroot(dest_dir_full_path)) {
close(r->dest_dir_fd);
r->dest_dir_fd = -1;
}
- if (r->full_root_path) {
- free(r->full_root_path);
- r->full_root_path = NULL;
- }
+
return ret;
}