Call abort_acquisition if starting sampling fails in acquisition_start, this will ensure that all already allocated resources are being freed again.
Signed-off-by: Lars-Peter Clausen <[email protected]> --- libsigrok/hardware/fx2lafw/fx2lafw.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libsigrok/hardware/fx2lafw/fx2lafw.c b/libsigrok/hardware/fx2lafw/fx2lafw.c index 11e41ff..59ad5e7 100644 --- a/libsigrok/hardware/fx2lafw/fx2lafw.c +++ b/libsigrok/hardware/fx2lafw/fx2lafw.c @@ -946,9 +946,9 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data) 2 | LIBUSB_ENDPOINT_IN, buf, size, receive_transfer, ctx, timeout); if (libusb_submit_transfer(transfer) != 0) { - /* TODO: Free them all. */ libusb_free_transfer(transfer); g_free(buf); + abort_acquisition(ctx); return SR_ERR; } ctx->transfers[i] = transfer; @@ -976,6 +976,7 @@ static int hw_dev_acquisition_start(int dev_index, void *cb_data) if ((ret = command_start_acquisition (ctx->usb->devhdl, ctx->cur_samplerate, ctx->sample_wide)) != SR_OK) { + abort_acquisition(ctx); return ret; } -- 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

