diff options
author | Nedim Hadzic <nhadzic@blackberry.com> | 2014-02-21 11:00:25 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-21 14:45:19 +0100 |
commit | 97b7f024eacc63d5b54b0bbc1be25c3bf1e17498 (patch) | |
tree | 214e1c244caf113ac68a54b7c0a22e02913e9adc | |
parent | ebb35fd588cd2294a7804193c2590a0fd4b5ccd2 (diff) |
Socket memory leak fix for QBluetoothServer QNX
listen(const QBluetoothAddress &address, quint16 port) was leaking memory if socket was not in listening state.
This occurred when calling a method multiple times.
Task-number: QTBUG-36626
Change-Id: I6a90f865d6c0e69d9f0b7acf0d200ec71910d448
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
-rw-r--r-- | src/bluetooth/qbluetoothserver_qnx.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bluetooth/qbluetoothserver_qnx.cpp b/src/bluetooth/qbluetoothserver_qnx.cpp index d4289368..c7015683 100644 --- a/src/bluetooth/qbluetoothserver_qnx.cpp +++ b/src/bluetooth/qbluetoothserver_qnx.cpp @@ -155,11 +155,11 @@ bool QBluetoothServer::listen(const QBluetoothAddress &address, quint16 port) } // listen has already been called before - if (d->socket && d->socket->state() == QBluetoothSocket::ListeningState) + if (!d->socket) + d->socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol); + else if (d->socket->state() == QBluetoothSocket::ListeningState) return false; - d->socket = new QBluetoothSocket(QBluetoothServiceInfo::RfcommProtocol); - //We can not register an actual Rfcomm port, because the platform does not allow it //but we need a way to associate a server with a service |