The branch, eeprom-new has been updated
via 5e77e87002972d3e5794a4b375cd78a5ae6dde01 (commit)
from 118c45611363a6148dfcf09882fb6136dafda5d8 (commit)
- Log -----------------------------------------------------------------
commit 5e77e87002972d3e5794a4b375cd78a5ae6dde01
Author: Thomas Jarosch <thomas.jarosch@xxxxxxxxxxxxx>
Date: Sat Jan 15 17:06:55 2011 +0100
Fix memleak on ftdi_write_data_submit() error
-----------------------------------------------------------------------
Summary of changes:
src/ftdi.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/ftdi.c b/src/ftdi.c
index a2cc5a6..adf682f 100644
--- a/src/ftdi.c
+++ b/src/ftdi.c
@@ -1376,19 +1376,22 @@ static void ftdi_write_data_cb(struct libusb_transfer
*transfer)
struct ftdi_transfer_control *ftdi_write_data_submit(struct ftdi_context
*ftdi, unsigned char *buf, int size)
{
struct ftdi_transfer_control *tc;
- struct libusb_transfer *transfer = libusb_alloc_transfer(0);
+ struct libusb_transfer *transfer;
int write_size, ret;
if (ftdi == NULL || ftdi->usb_dev == NULL)
- {
- libusb_free_transfer(transfer);
return NULL;
- }
tc = (struct ftdi_transfer_control *) malloc (sizeof (*tc));
+ if (!tc)
+ return NULL;
- if (!tc || !transfer)
+ transfer = libusb_alloc_transfer(0);
+ if (!transfer)
+ {
+ free(tc);
return NULL;
+ }
tc->ftdi = ftdi;
tc->completed = 0;
@@ -1410,8 +1413,7 @@ struct ftdi_transfer_control
*ftdi_write_data_submit(struct ftdi_context *ftdi,
if (ret < 0)
{
libusb_free_transfer(transfer);
- tc->completed = 1;
- tc->transfer = NULL;
+ free(tc);
return NULL;
}
tc->transfer = transfer;
hooks/post-receive
--
port libftdi to libusb-1.0
--
libftdi-git - see http://www.intra2net.com/en/developer/libftdi for details.
To unsubscribe send a mail to libftdi-git+unsubscribe@xxxxxxxxxxxxxxxxxxxxxxx
|