From f8ff297e7983d2ec15a85ffd4a815b0500ebadb9 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Tue, 3 Dec 2013 22:44:40 +0100 Subject: 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 Reviewed-by: Alex Blasche --- src/bluetooth/qbluetoothservicediscoveryagent_qnx.cpp | 8 ++++---- 1 file 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; -- cgit v1.2.3