summaryrefslogtreecommitdiffstats
path: root/qtserialbluetooth.cpp
diff options
context:
space:
mode:
authorGravatar Miika Turkia <miika.turkia@gmail.com>2015-09-09 18:34:49 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-09-09 09:14:16 -0700
commit43627922e0c7ba50b7db95175678ae1a9f7dbdce (patch)
tree184649a3348f40881f9ac3389ae037acd2b265a6 /qtserialbluetooth.cpp
parentce608b7ecf795865906082a5af89d724896d1dea (diff)
downloadsubsurface-43627922e0c7ba50b7db95175678ae1a9f7dbdce.tar.gz
Delay freeing of memory after use
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.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/qtserialbluetooth.cpp b/qtserialbluetooth.cpp
index 45fc8d1ec..ebbd1d451 100644
--- a/qtserialbluetooth.cpp
+++ b/qtserialbluetooth.cpp
@@ -151,12 +151,12 @@ static int qt_serial_open(serial_t **out, dc_context_t *context, const char* dev
}
#endif
if (serial_port->socket->state() != QBluetoothSocket::ConnectedState) {
- free (serial_port);
// Get the latest error and try to match it with one from libdivecomputer
QBluetoothSocket::SocketError err = serial_port->socket->error();
qDebug() << "Failed to connect to device " << devaddr << ". Device state " << serial_port->socket->state() << ". Error: " << err;
+ free (serial_port);
switch(err) {
case QBluetoothSocket::HostNotFoundError:
case QBluetoothSocket::ServiceNotFoundError: