diff options
author | Nikias Bassen | 2019-09-13 11:54:22 +0200 |
---|---|---|
committer | Nikias Bassen | 2019-09-13 11:55:26 +0200 |
commit | 1afa7350f9da03365f3b8f98dcb763b396e52723 (patch) | |
tree | 5087ef077955a6f7e1bfeb9f45bd52b83678a971 /src | |
parent | 1f8ddeff95884da404a7fbd74d27e04ca8c99a50 (diff) | |
download | usbmuxd-1afa7350f9da03365f3b8f98dcb763b396e52723.tar.gz usbmuxd-1afa7350f9da03365f3b8f98dcb763b396e52723.tar.bz2 |
device: Plug memory leak in error condition when TH_SYN sending fails
Diffstat (limited to 'src')
-rw-r--r-- | src/device.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/device.c b/src/device.c index 3edaea0..0cd9af4 100644 --- a/src/device.c +++ b/src/device.c @@ -344,10 +344,8 @@ static void connection_teardown(struct mux_connection *conn) client_close(conn->client); } } - if(conn->ib_buf) - free(conn->ib_buf); - if(conn->ob_buf) - free(conn->ob_buf); + free(conn->ib_buf); + free(conn->ob_buf); collection_remove(&conn->dev->connections, conn); free(conn); } @@ -394,6 +392,8 @@ int device_start_connect(int device_id, uint16_t dport, struct mux_client *clien res = send_tcp(conn, TH_SYN, NULL, 0); if(res < 0) { usbmuxd_log(LL_ERROR, "Error sending TCP SYN to device %d (%d->%d)", dev->id, sport, dport); + free(conn->ib_buf); + free(conn->ob_buf); free(conn); return -RESULT_CONNREFUSED; //bleh } |