This may happen if the acquisition_start is called right after calling
acquisition_stop and not all transfers have been freed or on repeated calls to
acquisition_start. If it happens we'll enter an undefined state and all kind of
strange behavior may occur, so error out in such a case.

Signed-off-by: Lars-Peter Clausen <[email protected]>
---
 libsigrok/hardware/fx2lafw/fx2lafw.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libsigrok/hardware/fx2lafw/fx2lafw.c 
b/libsigrok/hardware/fx2lafw/fx2lafw.c
index 2886613..11e41ff 100644
--- a/libsigrok/hardware/fx2lafw/fx2lafw.c
+++ b/libsigrok/hardware/fx2lafw/fx2lafw.c
@@ -918,6 +918,10 @@ static int hw_dev_acquisition_start(int dev_index, void 
*cb_data)
        if (!(sdi = sr_dev_inst_get(dev_insts, dev_index)))
                return SR_ERR;
        ctx = sdi->priv;
+
+       if (ctx->submitted_transfers != 0)
+               return SR_ERR;
+
        ctx->session_dev_id = cb_data;
        ctx->num_samples = 0;
        ctx->empty_transfer_count = 0;
-- 
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