diff options
author | Nigel Croxon <ncroxon@redhat.com> | 2024-07-02 15:49:13 +0200 |
---|---|---|
committer | Mariusz Tkaczyk <mariusz.tkaczyk@linux.intel.com> | 2024-07-03 12:56:08 +0200 |
commit | 0244bac0a828e69aef36404437cac4ff148eaea0 (patch) | |
tree | 722faa3408b1ebe40a1ed249712831a1d9e6a09f | |
parent | config.c: Fix memory leak in load_containers() (diff) | |
download | mdadm-0244bac0a828e69aef36404437cac4ff148eaea0.tar.xz mdadm-0244bac0a828e69aef36404437cac4ff148eaea0.zip |
mdadm: Build.c fix coverity issues
Event leaked_handle: Handle variable "bitmap_fd" going out of
scope leaks the handle.
Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
Diffstat (limited to '')
-rw-r--r-- | Build.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -168,13 +168,13 @@ int Build(struct mddev_ident *ident, struct mddev_dev *devlist, struct shape *s, goto abort; } } - if (bitmap_fd >= 0) { - if (ioctl(mdfd, SET_BITMAP_FILE, bitmap_fd) < 0) { - pr_err("Cannot set bitmap file for %s: %s\n", chosen_name, - strerror(errno)); - goto abort; - } + if (ioctl(mdfd, SET_BITMAP_FILE, bitmap_fd) < 0) { + pr_err("Cannot set bitmap file for %s: %s\n", chosen_name, + strerror(errno)); + close(bitmap_fd); + goto abort; } + close(bitmap_fd); } if (ioctl(mdfd, RUN_ARRAY, ¶m)) { pr_err("RUN_ARRAY failed: %s\n", strerror(errno)); |