libftdi Archives

Subject: memory leak in examples/find_all.c (1.0)

From: Matthias Janke <matthias.janke@xxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Mon, 20 Jun 2011 16:39:16 +0200
Hi,

I used ftdi_usb_find_all() in my own program, which eposed a memory leak, so I
tested examples/find_all.c and it leaks, too (valgrind output below). Is this
the leak Uwe mentioned here
http://developer.intra2net.com/mailarchive/html/libftdi/2010/msg00213.html ? 
If so is there a patch I've overlooked? I'm using a fresh libftdi-1.0/master
checkout from today.

Cheers,
Matthias

# valgrind --leak-check=full --show-reachable=yes --track-origins=yes
libftdi-1.0/build/examples/find_all 
==7828== Memcheck, a memory error detector 
==7828== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al. 
==7828== Using Valgrind-3.6.1 and LibVEX; rerun with -h for copyright info
==7828== Command: libftdi-1.0/build/examples/find_all 
==7828== 
Number of FTDI devices found: 0
==7828== 
==7828== HEAP SUMMARY:
==7828==     in use at exit: 1,136 bytes in 19 blocks
==7828==   total heap usage: 46 allocs, 27 frees, 82,248 bytes allocated
==7828== 
==7828== 48 bytes in 9 blocks are indirectly lost in loss record 1 of 3
==7828==    at 0x4C27610: malloc (vg_replace_malloc.c:236)
==7828==    by 0x5043E1B: initialize_device (in /usr/lib64/libusb-1.0.so.0.0.0)
==7828==    by 0x50442D9: sysfs_scan_device (in /usr/lib64/libusb-1.0.so.0.0.0)
==7828==    by 0x50445B1: op_get_device_list (in /usr/lib64/libusb-1.0.so.0.0.0)
==7828==    by 0x503DAD0: libusb_get_device_list
(in /usr/lib64/libusb-1.0.so.0.0.0) 
==7828==    by 0x4E3193A: ftdi_usb_find_all (ftdi.c:276) 
==7828==    by 0x400A53: main (find_all.c:25) 
==7828== 
==7828== 1,008 bytes in 9 blocks are indirectly lost in loss record 2 of 3
==7828==    at 0x4C27610: malloc (vg_replace_malloc.c:236) 
==7828==    by 0x503D7A5: usbi_alloc_device (in /usr/lib64/libusb-1.0.so.0.0.0)
==7828==    by 0x50442B7: sysfs_scan_device (in /usr/lib64/libusb-1.0.so.0.0.0)
==7828==    by 0x50445B1: op_get_device_list
(in /usr/lib64/libusb-1.0.so.0.0.0) 
==7828==    by 0x503DAD0: libusb_get_device_list
(in /usr/lib64/libusb-1.0.so.0.0.0) 
==7828==    by 0x4E3193A: ftdi_usb_find_all (ftdi.c:276) 
==7828==    by 0x400A53: main (find_all.c:25) 
==7828== 
==7828== 1,136 (80 direct, 1,056 indirect) bytes in 1 blocks are definitely
lost in loss record 3 of 3 
==7828==    at 0x4C27610: malloc (vg_replace_malloc.c:236) 
==7828==    by 0x503DAEB: libusb_get_device_list
(in /usr/lib64/libusb-1.0.so.0.0.0) 
==7828==    by 0x4E3193A: ftdi_usb_find_all (ftdi.c:276) 
==7828==    by 0x400A53: main (find_all.c:25) 
==7828== 
==7828== LEAK SUMMARY:
==7828== definitely lost: 80 bytes in 1 blocks 
==7828==    indirectly lost: 1,056 bytes in 18 blocks 
==7828==      possibly lost: 0 bytes in 0 blocks 
==7828==    still reachable: 0 bytes in 0 blocks 
==7828==         suppressed: 0 bytes in 0 blocks 
==7828== 
==7828== For counts of detected and suppressed errors, rerun with: -v
==7828== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 4 from 4)

-- 
---------------------------------------------------------------------
 Dipl.-Phys. Matthias Janke

 Physikalisches Institut der Universität Heidelberg
 Philosophenweg 12
 69120 Heidelberg
 Deutschland

 Tel:    +49 (6221) 54 93 72
 Fax:    +49 (6221) 54 94 52
 E-Mail: matthias.janke@xxxxxxxxxxxxxxxxxxxxxxx

 Büro:
 Albert-Überle-Straße 3-5
 Zi. 158, Ostflügel, 1.OG
---------------------------------------------------------------------

--
libftdi - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx

Current Thread