From 3f161215dd12276db6344758320d466050725bcb Mon Sep 17 00:00:00 2001 From: Alex Date: Sun, 30 Oct 2016 23:03:43 -0500 Subject: [PATCH] Fix a few errors.. --- serial/serbridge.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/serial/serbridge.c b/serial/serbridge.c index e82e3b4..875481c 100644 --- a/serial/serbridge.c +++ b/serial/serbridge.c @@ -19,7 +19,6 @@ static struct espconn serbridgeConn[1]; // plain bridging port static struct espconn serbridgeConn[2]; // programming port static esp_tcp serbridgeTcp[1], serbridgeTcp[2]; -static esp_tcp serbridgeTcp1, serbridgeTcp2; static int8_t mcu_reset_pin, mcu_isp_pin; uint8_t in_mcu_flashing; // for disabling slip during MCU flashing @@ -487,7 +486,7 @@ serbridgeStart(int ix, int port, int mode) if (ix < 0 || ix > 2) // FIXME hardcoded limit return; - if (serbridgeConn[ix] != NULL) { serbridgeCleanup(serbridgeConn[ix]); } //If we are already initialized, let's clean it up. + if (serbridgeConn[ix] != NULL) { serbridgeCleanup(ix); } //If we are already initialized, let's clean it up. if (0 < port && port < 65536 && port != 80) { serbridgeConn[ix].type = ESPCONN_TCP; serbridgeConn[ix].state = ESPCONN_NONE; @@ -502,13 +501,12 @@ serbridgeStart(int ix, int port, int mode) } static void ICACHE_FLASH_ATTR -serbridgeCleanup(void *arg) +serbridgeCleanup(int ix) { - serbridgeConnData *conn = ((struct espconn*)arg)->reverse; - if (conn == NULL) return; + if (serbridgeConn[ix] == NULL) return; // Free memory & set to NULL - os_free(conn); - conn = NULL; + os_free(serbridgeConn[ix]); + serbridgeConn[ix] = NULL; } int ICACHE_FLASH_ATTR serbridgeInMCUFlashing()