aboutsummaryrefslogtreecommitdiffstats
path: root/qtserialbluetooth.cpp
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-09-10 07:19:03 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-09 21:33:37 -0700
commit54eefe2f7f96480e36db93eeb8524d7e65114d96 (patch)
tree4d19415d7f2377ca6999c4cc5cc9937707eb30c4 /qtserialbluetooth.cpp
parent1533191176f4f9c323c8a2d39929b15173424433 (diff)
downloadsubsurface-54eefe2f7f96480e36db93eeb8524d7e65114d96.tar.gz
Fix memory leak on serial bluetooth
Signed-off-by: Miika Turkia <miika.turkia@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qtserialbluetooth.cpp')
-rw-r--r--qtserialbluetooth.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/qtserialbluetooth.cpp b/qtserialbluetooth.cpp
index ebbd1d451..442702da7 100644
--- a/qtserialbluetooth.cpp
+++ b/qtserialbluetooth.cpp
@@ -54,8 +54,10 @@ static int qt_serial_open(serial_t **out, dc_context_t *context, const char* dev
// Create a RFCOMM socket
serial_port->socket = ::socket(AF_BTH, SOCK_STREAM, BTHPROTO_RFCOMM);
- if (serial_port->socket == INVALID_SOCKET)
+ if (serial_port->socket == INVALID_SOCKET) {
+ free(serial_port);
return DC_STATUS_IO;
+ }
SOCKADDR_BTH socketBthAddress;
int socketBthAddressBth = sizeof (socketBthAddress);