mirror of
https://github.com/amadvance/snapraid.git
synced 2026-12-05 06:10:13 -05:00
Free devlist allocations on error in devdereference_btrfs
This commit is contained in:
parent
14d25db309
commit
2f3ca18f32
1 changed files with 8 additions and 3 deletions
|
|
@ -674,7 +674,7 @@ static int devdereference_btrfs(uint64_t device, const char* dir, int fd, tommy_
|
||||||
if (errno == ENODEV || errno == ENOENT)
|
if (errno == ENODEV || errno == ENOENT)
|
||||||
continue; /* this is the expected error on missing id */
|
continue; /* this is the expected error on missing id */
|
||||||
log_error(errno, "Ioctl BTRFS_IOC_DEV_INFO failed. %s.", strerror(errno));
|
log_error(errno, "Ioctl BTRFS_IOC_DEV_INFO failed. %s.", strerror(errno));
|
||||||
return -1;
|
goto bail;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -682,7 +682,7 @@ static int devdereference_btrfs(uint64_t device, const char* dir, int fd, tommy_
|
||||||
struct stat st;
|
struct stat st;
|
||||||
if (stat((char*)dev_info.path, &st) != 0) {
|
if (stat((char*)dev_info.path, &st) != 0) {
|
||||||
/* LCOV_EXCL_START */
|
/* LCOV_EXCL_START */
|
||||||
return -1;
|
goto bail;
|
||||||
/* LCOV_EXCL_STOP */
|
/* LCOV_EXCL_STOP */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -697,9 +697,14 @@ static int devdereference_btrfs(uint64_t device, const char* dir, int fd, tommy_
|
||||||
|
|
||||||
/* something has to be found */
|
/* something has to be found */
|
||||||
if (found == 0)
|
if (found == 0)
|
||||||
return -1;
|
goto bail;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
bail:
|
||||||
|
tommy_list_foreach(devlist, free);
|
||||||
|
tommy_list_init(devlist);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int devdereference_bcachefs(uint64_t device, const char* dir, tommy_list* devlist)
|
static int devdereference_bcachefs(uint64_t device, const char* dir, tommy_list* devlist)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue