Free the USB transfers in the reverse order of which they were submitted. This
will avoid that while transfer 0 is canceld transfer 1 is started  by the host
controller, and so on.

Reported-by: Peter Stuge <[email protected]>
Signed-off-by: Lars-Peter Clausen <[email protected]>

---
Sorry, sent an old version of the patch as v1.
---
 libsigrok/hardware/fx2lafw/fx2lafw.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libsigrok/hardware/fx2lafw/fx2lafw.c 
b/libsigrok/hardware/fx2lafw/fx2lafw.c
index be84761..334a110 100644
--- a/libsigrok/hardware/fx2lafw/fx2lafw.c
+++ b/libsigrok/hardware/fx2lafw/fx2lafw.c
@@ -662,11 +662,11 @@ static int receive_data(int fd, int revents, void 
*cb_data)
 
 static void abort_acquisition(struct context *ctx)
 {
-       unsigned int i;
+       int i;
 
        ctx->num_samples = -1;
 
-       for (i = 0; i < ctx->num_transfers; i++) {
+       for (i = ctx->num_transfers - 1; i >= 0; i--) {
                if (ctx->transfers[i])
                        libusb_cancel_transfer(ctx->transfers[i]);
        }
-- 
1.7.10


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to