mirror of
https://github.com/RPCS3/libusb.git
synced 2026-07-21 00:16:04 -04:00
openbsd: Fix a memleak
discovered_devs_append takes a reference to the past in dev, so we must release our own reference. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
@@ -186,7 +186,9 @@ obsd_get_device_list(struct libusb_context * ctx,
|
||||
session_id = (di.udi_bus << 8 | di.udi_addr);
|
||||
dev = usbi_get_device_by_session_id(ctx, session_id);
|
||||
|
||||
if (dev == NULL) {
|
||||
if (dev) {
|
||||
dev = libusb_ref_device(dev);
|
||||
} else {
|
||||
dev = usbi_alloc_device(ctx, session_id);
|
||||
if (dev == NULL) {
|
||||
close(fd);
|
||||
@@ -226,6 +228,7 @@ obsd_get_device_list(struct libusb_context * ctx,
|
||||
close(fd);
|
||||
return (LIBUSB_ERROR_NO_MEM);
|
||||
}
|
||||
libusb_unref_device(dev);
|
||||
|
||||
*discdevs = ddd;
|
||||
devices[addr] = 1;
|
||||
|
||||
@@ -1 +1 @@
|
||||
#define LIBUSB_NANO 10832
|
||||
#define LIBUSB_NANO 10833
|
||||
|
||||
Reference in New Issue
Block a user