diff mbox series

[BlueZ] emulator: fix potential resource leak

Message ID 20211116064949.463398-1-hj.tedd.an@gmail.com (mailing list archive)
State Accepted
Delegated to: Luiz Von Dentz
Headers show
Series [BlueZ] emulator: fix potential resource leak | expand

Checks

Context Check Description
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS
tedd_an/setupell success Setup ELL PASS
tedd_an/buildprep success Build Prep PASS
tedd_an/build success Build Configuration PASS
tedd_an/makecheck success Make Check PASS
tedd_an/makedistcheck success Make Distcheck PASS
tedd_an/build_extell success Build External ELL PASS
tedd_an/build_extell_make success Build Make with External ELL PASS

Commit Message

Tedd Ho-Jeong An Nov. 16, 2021, 6:49 a.m. UTC
From: Tedd Ho-Jeong An <tedd.an@intel.com>

This patch releases the allocated fd to prevent the potential resource
leak. This was reported by the Coverity scan.
---
 emulator/vhci.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

bluez.test.bot@gmail.com Nov. 16, 2021, 7:35 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=580675

---Test result---

Test Summary:
CheckPatch                    PASS      1.43 seconds
GitLint                       PASS      1.01 seconds
Prep - Setup ELL              PASS      46.31 seconds
Build - Prep                  PASS      0.52 seconds
Build - Configure             PASS      8.83 seconds
Build - Make                  PASS      201.01 seconds
Make Check                    PASS      9.37 seconds
Make Distcheck                PASS      240.56 seconds
Build w/ext ELL - Configure   PASS      8.97 seconds
Build w/ext ELL - Make        PASS      190.08 seconds



---
Regards,
Linux Bluetooth
diff mbox series

Patch

diff --git a/emulator/vhci.c b/emulator/vhci.c
index 59ad1ecb8..014df87d2 100644
--- a/emulator/vhci.c
+++ b/emulator/vhci.c
@@ -140,8 +140,10 @@  struct vhci *vhci_open(uint8_t type)
 	}
 
 	vhci = malloc(sizeof(*vhci));
-	if (!vhci)
+	if (!vhci) {
+		close(fd);
 		return NULL;
+	}
 
 	memset(vhci, 0, sizeof(*vhci));
 	vhci->type = type;