• Philippe Teuwen's avatar
    Fix mem leak with libusb by introducing buses/usbbus.c · 9dcf7378
    Philippe Teuwen authored
    Now call only once usb_init(); usb_find_busses(); usb_find_devices()
    instead of multiple calls in several scan() then open()
    
    This fixes the following leaks:
    
    ==1159== 8 bytes in 1 blocks are definitely lost in loss record 9 of 102
    ==1159==    at 0x4C28BED: malloc (vg_replace_malloc.c:263)
    ==1159==    by 0x53D9931: usb_parse_configuration (in /lib/x86_64-linux-gnu/libusb-0.1.so.4.4.4)
    ==1159==    by 0x53DB8B1: usb_os_find_devices (in /lib/x86_64-linux-gnu/libusb-0.1.so.4.4.4)
    ==1159==    by 0x53D8FDC: usb_find_devices (in /lib/x86_64-linux-gnu/libusb-0.1.so.4.4.4)
    ==1159==    by 0x4E41D79: pn53x_usb_scan (in /usr/lib/x86_64-linux-gnu/libnfc.so.4.0.0)
    ==1159==
    ==1159== 8 bytes in 1 blocks are definitely lost in loss record 10 of 102
    ==1159==    at 0x4C28BED: malloc (vg_replace_malloc.c:263)
    ==1159==    by 0x53D9931: usb_parse_configuration (in /lib/x86_64-linux-gnu/libusb-0.1.so.4.4.4)
    ==1159==    by 0x53DB8B1: usb_os_find_devices (in /lib/x86_64-linux-gnu/libusb-0.1.so.4.4.4)
    ==1159==    by 0x53D8FDC: usb_find_devices (in /lib/x86_64-linux-gnu/libusb-0.1.so.4.4.4)
    ==1159==    by 0x4E42CC7: pn53x_usb_open (in /usr/lib/x86_64-linux-gnu/libnfc.so.4.0.0)
    ==1159==    by 0x4E351E6: nfc_open (in /usr/lib/x86_64-linux-gnu/libnfc.so.4.0.0)
    9dcf7378
Name
Last commit
Last update
cmake Loading commit data...
contrib Loading commit data...
debian Loading commit data...
examples Loading commit data...
include Loading commit data...
libnfc Loading commit data...
m4 Loading commit data...
test Loading commit data...
utils Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CMakeLists.txt Loading commit data...
COPYING Loading commit data...
ChangeLog Loading commit data...
Doxyfile.in Loading commit data...
HACKING Loading commit data...
Makefile.am Loading commit data...
NEWS Loading commit data...
README Loading commit data...
README-Windows.txt Loading commit data...
configure.ac Loading commit data...
libnfc.conf.sample Loading commit data...
libnfc.pc.in Loading commit data...
make_release.sh Loading commit data...
manual-test-results.txt Loading commit data...
mingw-cross-configure.sh Loading commit data...