mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-16 00:34:39 +08:00
emulator: fix potential resource leak
This patch releases the allocated fd to prevent the potential resource leak. This was reported by the Coverity scan.
This commit is contained in:
parent
f59a6d4a4e
commit
270c8d07a0
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user