if (bconf.verbose > BTRFS_BCONF_QUIET)
fprintf(stderr, "Chroot to %s\n", dest_dir_full_path);
rctx->root_path = strdup("/");
+ if (!rctx->root_path) {
+ ret = -ENOMEM;
+ goto out;
+ }
rctx->dest_dir_path = rctx->root_path;
} else {
/*
len += add_len + 1;
} else {
full_path = strdup(found->path);
+ if (!full_path)
+ return -ENOMEM;
len = add_len;
}
if (!ri->top_id)
goto out;
}
dupdname = strdup(cpath);
+ if (!dupdname) {
+ error_mem("duplicate path");
+ ret = -ENOMEM;
+ goto out;
+ }
dname = path_dirname(dupdname);
dupvname = strdup(cpath);
+ if (!dupvname) {
+ error_mem("duplicate path");
+ ret = -ENOMEM;
+ goto out;
+ }
vname = path_basename(dupvname);
free(cpath);
const char *newname;
dupname = strdup(subvol);
+ if (!dupname) {
+ error_mem("duplicate subvolume");
+ goto out;
+ }
newname = path_basename(dupname);
dstdir = malloc(strlen(dst) + 1 + strlen(newname) + 1);
free(dupname);
} else {
dstdir = strdup(dst);
+ if (!dstdir) {
+ error_mem(NULL);
+ goto out;
+ }
}
err = btrfs_util_subvolume_snapshot(subvol, dstdir, flags, NULL, inherit);
if (subvol.id == BTRFS_FS_TREE_OBJECTID) {
free(subvol_path);
subvol_path = strdup("/");
+ if (!subvol_path) {
+ error_mem(NULL);
+ ret = -ENOMEM;
+ goto out;
+ }
subvol_name = "<FS_TREE>";
} else {
subvol_name = path_basename(subvol_path);
case 'f':
free(filter);
filter = strdup(optarg);
+ if (!filter) {
+ error_mem("filter");
+ return 1;
+ }
printf("Use filter: %s\n", filter);
break;
case 't':
exit(1);
}
label = strdup(optarg);
+ if (!label) {
+ error_mem("option label");
+ exit(1);
+ }
break;
case 'm':
ret = parse_bg_profile(optarg, &metadata_profile);
char *orig = strdup(optarg);
char *tmp = orig;
+ if (!orig) {
+ error_mem("option features");
+ ret = 1;
+ goto error;
+ }
+
tmp = btrfs_parse_fs_features(tmp, &features);
if (tmp) {
error("unrecognized filesystem feature '%s'",
char *orig = strdup(optarg);
char *tmp = orig;
+ if (!orig) {
+ error_mem("option runtime features");
+ ret = 1;
+ goto error;
+ }
+
warning("runtime features are deprecated, use -O, --features instead");
tmp = btrfs_parse_runtime_features(tmp,
&features);
case 'r':
free(source_dir);
source_dir = strdup(optarg);
+ if (!source_dir) {
+ error_mem("option source directory");
+ ret = 1;
+ goto error;
+ }
break;
case 'u':
ret = parse_subvolume(optarg, &subvols, &has_default_subvol);
/* final cs */
checksum = strdup(l);
+ if (!checksum) {
+ fprintf(stderr, "allocating checksum\n");
+ exit(1);
+ }
break;
}
if (rem_c == l) {
} else if (cmp > 0) {
excess_file(fn);
prev_fn = strdup(l);
+ if (!prev_fn) {
+ fprintf(stderr, "memory allocation error\n");
+ exit(1);
+ }
prev_m = strdup(rem_m);
+ if (!prev_m) {
+ fprintf(stderr, "memory allocation error\n");
+ exit(1);
+ }
prev_c = strdup(rem_c);
+ if (!prev_c) {
+ fprintf(stderr, "memory allocation error\n");
+ exit(1);
+ }
return;
}
missing_file(l);
if (checksum)
free(checksum);
checksum = strdup(p);
+ if (!checksum) {
+ fprintf(stderr, "memory allocation error\n");
+ exit(1);
+ }
} else {
fprintf(stderr, "invalid input file format\n");
exit(-1);