libftdi Archives

Subject: libdtdi-1: Crash in asyn transfer

From: Uwe Bonnes <bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
To: libftdi@xxxxxxxxxxxxxxxxxxxxxxx
Date: Tue, 2 Feb 2010 23:36:20 +0100
When trying async transfer with my FT2232 sync FIFO gadget, I had to apply
appended patch. Probably transfer->status is only set when the transfer is
complete or otherwise aborted.

Does the patch look resonable?
-- 
Uwe Bonnes                bon@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Institut fuer Kernphysik  Schlossgartenstrasse 9  64289 Darmstadt
--------- Tel. 06151 162516 -------- Fax. 06151 164321 ----------
diff --git a/src/ftdi.c b/src/ftdi.c
index 22e746d..f1d3fa5 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -1437,8 +1437,9 @@ int ftdi_transfer_data_done(struct ftdi_transfer_control 
*tc)
             return ret;
         }
     }
-
-    if (tc->transfer->status == LIBUSB_TRANSFER_COMPLETED)
+    if (tc->transfer == 0)
+      return 0;
+    else if (tc->transfer->status == LIBUSB_TRANSFER_COMPLETED)
         ret = tc->offset;
     else
         ret = -1;

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

Current Thread