From c3f06de60b69a667fe9002f5f92a78e4a699f30c Mon Sep 17 00:00:00 2001 From: Carl Philipp Klemm Date: Tue, 26 Aug 2025 14:05:42 +0200 Subject: [PATCH] Dont let usbshm leak descriptors in usbshm_find --- usbshm.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/usbshm.c b/usbshm.c index e588088..1eb1814 100644 --- a/usbshm.c +++ b/usbshm.c @@ -125,6 +125,7 @@ int usbshm_find(struct usbshm* instance, int vendorID, int productID, unsigned c (*serials)[*count] = calloc(16, 1); libusb_get_string_descriptor_ascii(handle, desc.iSerialNumber, (*serials)[*count], 16); ++(*count); + libusb_close(handle); } else { @@ -140,6 +141,8 @@ int usbshm_find(struct usbshm* instance, int vendorID, int productID, unsigned c return USBSHM_ERROR_ERR; } + libusb_free_device_list(list, true); + pthread_mutex_unlock(instance->mutex); return 0;