#include <math.h>
#include <ftw.h>
#include <wait.h>
+#include <assert.h>
#include <sys/stat.h>
#include <sys/types.h>
goto out;
}
- ret = btrfs_list_get_path_rootid(subvol_fd, &r->cur_subvol->root_id);
- if (ret < 0)
- goto out;
- subvol_uuid_search_add(&r->sus, r->cur_subvol);
- r->cur_subvol = NULL;
ret = 0;
out:
+ if (r->cur_subvol) {
+ free(r->cur_subvol->path);
+ free(r->cur_subvol);
+ r->cur_subvol = NULL;
+ }
if (subvol_fd != -1)
close(subvol_fd);
return ret;
struct btrfs_receive *r = user;
char uuid_str[128];
struct btrfs_ioctl_vol_args_v2 args_v2;
- struct subvol_info *parent_subvol;
+ struct subvol_info *parent_subvol = NULL;
ret = finish_subvol(r);
if (ret < 0)
}
out:
+ if (parent_subvol) {
+ free(parent_subvol->path);
+ free(parent_subvol);
+ }
return ret;
}
const char *clone_path, u64 clone_offset,
void *user)
{
- int ret = 0;
+ int ret;
struct btrfs_receive *r = user;
struct btrfs_ioctl_clone_range_args clone_args;
struct subvol_info *si = NULL;
}
out:
+ if (si) {
+ free(si->path);
+ free(si);
+ }
free(full_path);
free(full_clone_path);
free(subvol_path);