mirror of
https://github.com/amadvance/snapraid.git
synced 2026-10-26 02:49:02 -04:00
Fix leak on error in the new devup
This commit is contained in:
parent
bf7b341310
commit
a2dd9a5f1c
1 changed files with 3 additions and 0 deletions
|
|
@ -1379,6 +1379,7 @@ static int devup(dev_t device)
|
|||
f = open(file, O_RDONLY | O_DIRECT);
|
||||
if (f < 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
free(buf);
|
||||
log_fatal("Failed to open device '%u:%u'.\n", major(device), minor(device));
|
||||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
|
@ -1388,6 +1389,7 @@ static int devup(dev_t device)
|
|||
if (ret < 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
close(f);
|
||||
free(buf);
|
||||
log_fatal("Failed to read device '%u:%u'.\n", major(device), minor(device));
|
||||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
|
@ -1396,6 +1398,7 @@ static int devup(dev_t device)
|
|||
ret = close(f);
|
||||
if (ret < 0) {
|
||||
/* LCOV_EXCL_START */
|
||||
free(buf);
|
||||
log_fatal("Failed to close device '%u:%u'.\n", major(device), minor(device));
|
||||
return -1;
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue