summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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: