libftdi Archives

Subject: Re: [1.0] Increment the refcount on devices we return from ftdi_usb_find_all(), was: Re: [1.0] 2 invalid frees

From: Matthias Janke <matthias.janke@xxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 28 Jun 2011 16:19:51 +0200
Am Tue, 28 Jun 2011 16:08:20 +0200
schrieb Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>:

> >>>>> "Matthias" == Matthias Janke <matthias.janke@xxxxxxxxxxxxxxxxxxxxxxx>
> >>>>> writes:
>     Matthias> Well, that solution should work (not tested yet) but is rather
>     Matthias> invasive. I was thinking of something which plays with the
>     Matthias> refcount mechanism of libusb changing: (*curdev)->dev = dev;
>     Matthias> to (*curdev)->dev = libusb_ref_device(dev); but I didn't find
>     Matthias> any docs on the behaviour of this mechanism, yet. so I'm not
>     Matthias> sure if it would work.
> 
> 
> Appended patch instead of 
> "1.0: Add the list retrieved by libusb_get_device_list to the ftdi_context
> and only release it on exit"
> seems to work to and is much less intrusive, as Matthias pointed out.
> 
> Bye

Works great! Thanks!:)
Matthias

-- 
---------------------------------------------------------------------
 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