diff options
author | Robin Burchell <robin.burchell@jollamobile.com> | 2013-12-03 22:44:40 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-05 11:45:06 +0100 |
commit | f8ff297e7983d2ec15a85ffd4a815b0500ebadb9 (patch) | |
tree | fd267356e9fe9d6f93c2efca6975c4a2ec577730 | |
parent | 6a07037765ea7c195e802472106448432a91ec78 (diff) | |
download | qtconnectivity-f8ff297e7983d2ec15a85ffd4a815b0500ebadb9.tar.gz |
QNX: Fix a dangling pointer use in QBluetoothServiceDiscoveryAgent on QNX
toUtf8 returns a temporary, we must not use a pointer inside it without making
sure that the QByteArray returned sticks around.
Change-Id: I4566d14f52acac083433dfe63c64365d119bbd17
Reviewed-by: Fabian Bumberger <fbumberger@rim.com>
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
-rw-r--r-- | src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp b/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp index 2ea847e6..4c18f0e0 100644 --- a/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp +++ b/src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp @@ -75,10 +75,10 @@ void QBluetoothServiceDiscoveryAgentPrivate::start(const QBluetoothAddress &addr { Q_Q(QBluetoothServiceDiscoveryAgent); qBBBluetoothDebug() << "Starting Service discovery for" << address.toString(); - const char *filePath = QByteArray("/pps/services/bluetooth/remote_devices/").append(address.toString().toUtf8().constData()).constData(); - if ((m_rdfd = qt_safe_open(filePath, O_RDONLY)) == -1) { - if (QFile::exists(QLatin1String(filePath) + QLatin1String("-00")) || - QFile::exists(QLatin1String(filePath) + QLatin1String("-01"))) { + QByteArray filePath = QByteArray("/pps/services/bluetooth/remote_devices/").append(address.toString().toUtf8().constData()); + if ((m_rdfd = qt_safe_open(filePath.constData(), O_RDONLY)) == -1) { + if (QFile::exists(filePath + QLatin1String("-00")) || + QFile::exists(filePath + QLatin1String("-01"))) { qBBBluetoothDebug() << "LE device discovered...skipping"; } else { qWarning() << "Failed to open " << filePath; |