Skip to contentSkip to conversation

emulator: fix potential resource leak

PATCH In review Tedd Ho-Jeong An 2 participants 2 messages Nov 16, 2021 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 emulator: fix potential resource leak

From: Tedd Ho-Jeong An <[email protected]>

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(-)
emulator/vhci.c +3 -1
index 59ad1ecb8..014df87d2 100644
@@ -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;
Signature · 1 line
2.25.1
#1 lore raw

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