From 5283a8792e8694596a9865c3e58c4f9f307ce38b Mon Sep 17 00:00:00 2001 From: Olaf Meeuwissen Date: Tue, 2 Dec 2014 11:37:25 +0900 Subject: [PATCH] Fix memory leak w/ libusb-1.0 (introduced in 71c1a00) --- sanei/sanei_usb.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sanei/sanei_usb.c b/sanei/sanei_usb.c index c0fa74d0b..c4f5c7cd6 100644 --- a/sanei/sanei_usb.c +++ b/sanei/sanei_usb.c @@ -1676,8 +1676,6 @@ sanei_usb_open (SANE_String_Const devname, SANE_Int * dn) result = libusb_set_configuration (devices[devcount].lu_handle, config0->bConfigurationValue); - libusb_free_config_descriptor (config0); - if (result < 0) { SANE_Status status = SANE_STATUS_INVAL; @@ -1700,10 +1698,12 @@ sanei_usb_open (SANE_String_Const devname, SANE_Int * dn) if (status != SANE_STATUS_GOOD) { libusb_close (devices[devcount].lu_handle); + libusb_free_config_descriptor (config0); return status; } } } + libusb_free_config_descriptor (config0); /* Claim the interface */ result = libusb_claim_interface (devices[devcount].lu_handle,