62 lines
1.8 KiB
Diff
62 lines
1.8 KiB
Diff
From 41fdb68d8ae4f556492addeae8366087e3576480 Mon Sep 17 00:00:00 2001
|
|
From: Thomas Jarosch <thomas.jarosch@intra2net.com>
|
|
Date: Tue, 19 Sep 2017 16:19:37 +0200
|
|
Subject: [PATCH] Fix ftdi_stream.c compilation on WIN32
|
|
|
|
---
|
|
src/ftdi_stream.c | 2 ++
|
|
1 files changed, 2 insertions(+), 0 deletions(-)
|
|
|
|
diff --git a/src/ftdi_stream.c b/src/ftdi_stream.c
|
|
index 2ed39b3..1dc46ea 100644
|
|
--- a/src/ftdi_stream.c
|
|
+++ b/src/ftdi_stream.c
|
|
@@ -41,7 +41,9 @@
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
+#ifndef _WIN32
|
|
#include <sys/time.h>
|
|
+#endif
|
|
#include <libusb.h>
|
|
|
|
#include "ftdi.h"
|
|
--
|
|
1.7.1
|
|
|
|
From 3b3a9614147038b37b69f5c2878841bad1db8af1 Mon Sep 17 00:00:00 2001
|
|
From: Rolf Fiedler <derRolf@gmx-topmail.de>
|
|
Date: Fri, 25 Aug 2017 11:33:35 +0200
|
|
Subject: [PATCH] Fix small memleak when ftdi_init() fails
|
|
|
|
If libusb open fails (e.g. permission problem),
|
|
then ftdi_init() leaks the memory for the eeprom data.
|
|
---
|
|
src/ftdi.c | 3 ++-
|
|
1 files changed, 2 insertions(+), 1 deletions(-)
|
|
|
|
diff --git a/src/ftdi.c b/src/ftdi.c
|
|
index 175befc..b336c80 100644
|
|
--- a/src/ftdi.c
|
|
+++ b/src/ftdi.c
|
|
@@ -87,7 +87,7 @@ static void ftdi_usb_close_internal (struct ftdi_context *ftdi)
|
|
*/
|
|
int ftdi_init(struct ftdi_context *ftdi)
|
|
{
|
|
- struct ftdi_eeprom* eeprom = (struct ftdi_eeprom *)malloc(sizeof(struct ftdi_eeprom));
|
|
+ struct ftdi_eeprom* eeprom;
|
|
ftdi->usb_ctx = NULL;
|
|
ftdi->usb_dev = NULL;
|
|
ftdi->usb_read_timeout = 5000;
|
|
@@ -111,6 +111,7 @@ int ftdi_init(struct ftdi_context *ftdi)
|
|
ftdi_set_interface(ftdi, INTERFACE_ANY);
|
|
ftdi->bitbang_mode = 1; /* when bitbang is enabled this holds the number of the mode */
|
|
|
|
+ eeprom = (struct ftdi_eeprom *)malloc(sizeof(struct ftdi_eeprom));
|
|
if (eeprom == 0)
|
|
ftdi_error_return(-2, "Can't malloc struct ftdi_eeprom");
|
|
memset(eeprom, 0, sizeof(struct ftdi_eeprom));
|
|
--
|
|
1.7.1
|
|
|