From: Tedd Ho-Jeong An Date: Tue, 16 Nov 2021 06:49:49 +0000 (-0800) Subject: emulator: fix potential resource leak X-Git-Tag: submit/tizen/20220313.220938~26 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f1bb0cb8560aed752d4037915266c989c346043c;p=platform%2Fupstream%2Fbluez.git emulator: fix potential resource leak This patch releases the allocated fd to prevent the potential resource leak. This was reported by the Coverity scan. Signed-off-by: Anuj Jain Signed-off-by: Ayush Garg --- diff --git a/emulator/vhci.c b/emulator/vhci.c index 59ad1ecb..014df87d 100755 --- 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;