summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-11-10 13:38:46 +0100
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-11-10 15:29:53 +0100
commit7386aabf3628379df10612bed7ecb7ab4163cdcf (patch)
tree6f239f61b426c785b1ca4f78d5c4333640883ee9
parentaa2c234ecb512bc4fc52fa1601377c31dfb58552 (diff)
mkfs.ubifs: close file descriptor in add_file error path
Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
-rw-r--r--ubifs-utils/mkfs.ubifs/mkfs.ubifs.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
index 72ae1b4..bf1290f 100644
--- a/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
+++ b/ubifs-utils/mkfs.ubifs/mkfs.ubifs.c
@@ -1873,8 +1873,10 @@ static int add_file(const char *path_name, struct stat *st, ino_t inum,
dn->compr_size = 0;
} else {
ret = encrypt_data_node(fctx, block_no, dn, out_len);
- if (ret < 0)
+ if (ret < 0) {
+ close(fd);
return ret;
+ }
out_len = ret;
}