mirror of
https://github.com/rtlsdrblog/rtl-sdr-blog.git
synced 2024-12-25 18:38:29 +01:00
fix a memory leak by unreferencing libusb devices
This commit is contained in:
parent
5371f206f3
commit
cdfd1cf775
@ -759,7 +759,7 @@ uint32_t rtlsdr_get_device_count(void)
|
||||
device_count++;
|
||||
}
|
||||
|
||||
libusb_free_device_list(list, 0);
|
||||
libusb_free_device_list(list, 1);
|
||||
|
||||
libusb_exit(ctx);
|
||||
|
||||
@ -793,7 +793,7 @@ const char *rtlsdr_get_device_name(uint32_t index)
|
||||
}
|
||||
}
|
||||
|
||||
libusb_free_device_list(list, 0);
|
||||
libusb_free_device_list(list, 1);
|
||||
|
||||
libusb_exit(ctx);
|
||||
|
||||
@ -847,12 +847,12 @@ int rtlsdr_open(rtlsdr_dev_t **out_dev, uint32_t index)
|
||||
|
||||
r = libusb_open(device, &dev->devh);
|
||||
if (r < 0) {
|
||||
libusb_free_device_list(list, 0);
|
||||
libusb_free_device_list(list, 1);
|
||||
fprintf(stderr, "usb_open error %d\n", r);
|
||||
goto err;
|
||||
}
|
||||
|
||||
libusb_free_device_list(list, 0);
|
||||
libusb_free_device_list(list, 1);
|
||||
|
||||
r = libusb_claim_interface(dev->devh, 0);
|
||||
if (r < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user