libusbx: backport upstream patches-epoch1 Signed-off-by: Zhiqiang Liu <lzhq28@mail.ustc.edu.cn>
33 lines
896 B
Diff
33 lines
896 B
Diff
From df7cb74443b31311bfc36977f1080aadbcac098d Mon Sep 17 00:00:00 2001
|
|
From: Ludovic Rousseau <ludovic.rousseau@free.fr>
|
|
Date: Fri, 1 Nov 2019 16:04:02 +0100
|
|
Subject: [PATCH 4/8] Linux backend: fix ressource leak
|
|
|
|
Issue detected by Coverity:
|
|
22. leaked_handle: Handle variable fd going out of scope leaks the handle.
|
|
|
|
Signed-off-by: Ludovic Rousseau <ludovic.rousseau@free.fr>
|
|
---
|
|
libusb/os/linux_usbfs.c | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/libusb/os/linux_usbfs.c b/libusb/os/linux_usbfs.c
|
|
index 63fe592..dace935 100644
|
|
--- a/libusb/os/linux_usbfs.c
|
|
+++ b/libusb/os/linux_usbfs.c
|
|
@@ -1049,7 +1049,11 @@ static int initialize_device(struct libusb_device *dev, uint8_t busnum,
|
|
}
|
|
|
|
if (sysfs_dir && sysfs_can_relate_devices)
|
|
+ {
|
|
+ if (fd != wrapped_fd)
|
|
+ close(fd);
|
|
return LIBUSB_SUCCESS;
|
|
+ }
|
|
|
|
/* cache active config */
|
|
if (wrapped_fd < 0)
|
|
--
|
|
2.27.0.windows.1
|
|
|