mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 10:51:54 -04:00
Free devlist allocations on error in devdereference_btrfs
This commit is contained in:
parent
c4511e28bc
commit
8562e4f28e
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)
|
||||
continue; /* this is the expected error on missing id */
|
||||
log_error(errno, "Ioctl BTRFS_IOC_DEV_INFO failed. %s.", strerror(errno));
|
||||
return -1;
|
||||
goto bail;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
|
|
@ -682,7 +682,7 @@ static int devdereference_btrfs(uint64_t device, const char* dir, int fd, tommy_
|
|||
struct stat st;
|
||||
if (stat((char*)dev_info.path, &st) != 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
return -1;
|
||||
goto bail;
|
||||
/* 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 */
|
||||
if (found == 0)
|
||||
return -1;
|
||||
goto bail;
|
||||
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue