diff options
author | Tedd Ho-Jeong An <tedd.an@intel.com> | 2021-11-15 22:49:49 -0800 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-11-22 14:26:35 -0800 |
commit | 270c8d07a07815188d4359b81e00db135ff3ff63 (patch) | |
tree | 540cd508cd7f8568c81c4d7415161f55653f403c /emulator | |
parent | f59a6d4a4e651bbd65f32eb16601f33a59927564 (diff) | |
download | bluez-270c8d07a07815188d4359b81e00db135ff3ff63.tar.gz |
emulator: fix potential resource leak
This patch releases the allocated fd to prevent the potential resource
leak. This was reported by the Coverity scan.
Diffstat (limited to 'emulator')
-rw-r--r-- | emulator/vhci.c | 4 |
1 files changed, 3 insertions, 1 deletions
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; |