aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Fritiofson <andreas.fritiofson@gmail.com>2013-03-19 13:58:24 +0000
committerSpencer Oliver <spen@spen-soft.co.uk>2013-04-17 09:50:31 +0000
commit46bcaec696ae0974b47aeaea876737f13d0c55e5 (patch)
treedc9b64b92436449da1f7f48c83f70e8f71162102
parent305832c49dc5193720b0ed58d3707891c60b9aaa (diff)
ft2232: remove ft2232_large_scan memory leak
This is a very long outstanding issue see: http://lists.berlios.de/pipermail/openocd-development/2011-June/019404.html As this driver is deprecated the fix is added to purely to reduce the warnings reported by clang. Change-Id: I3a16a704e0e8db27efda50fdcfdd35abf5ebed0f Signed-off-by: Spencer Oliver <spen@spen-soft.co.uk> Reviewed-on: http://openocd.zylin.com/1278 Tested-by: jenkins
-rw-r--r--src/jtag/drivers/ft2232.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c
index 4b3360fe..fed82985 100644
--- a/src/jtag/drivers/ft2232.c
+++ b/src/jtag/drivers/ft2232.c
@@ -1108,6 +1108,11 @@ static int ft2232_large_scan(struct scan_command *cmd,
int retval;
int thisrun_read = 0;
+ if (!receive_buffer) {
+ LOG_ERROR("failed to allocate memory");
+ exit(-1);
+ }
+
if (cmd->ir_scan) {
LOG_ERROR("BUG: large IR scans are not supported");
exit(-1);
@@ -1273,6 +1278,8 @@ static int ft2232_large_scan(struct scan_command *cmd,
(int)bytes_read);
}
+ free(receive_buffer);
+
return ERROR_OK;
}