diff options
author | Dyami Caliri <dyami@dragonframe.com> | 2014-09-24 15:07:01 -0700 |
---|---|---|
committer | Dyami Caliri <dyami@dragonframe.com> | 2014-09-25 16:32:59 +0200 |
commit | 738d20dbd952ccdf28187b64526733aab345031f (patch) | |
tree | 943a4016e5b60da273a9fb3276d899e9a2b7fd58 | |
parent | 06a4f3ddf7d9f0da6ec881958ebaa8e4bd041cb6 (diff) | |
download | qtserialport-738d20dbd952ccdf28187b64526733aab345031f.tar.gz |
Fix access after delete in OS X QSPI
Valgrind analysis shows that searchStringProperty was accessing memory
after deletion. This was caused by constructing QCFString local var
with CFStringRef, which does not retain object.
Change-Id: I1e9571a5051aa6f0c3fbc732ac01e821069f8b02
Reviewed-by: Sergey Belyashov <Sergey.Belyashov@gmail.com>
Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r-- | src/serialport/qserialportinfo_mac.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/serialport/qserialportinfo_mac.cpp b/src/serialport/qserialportinfo_mac.cpp index 03f95e7..865c3bf 100644 --- a/src/serialport/qserialportinfo_mac.cpp +++ b/src/serialport/qserialportinfo_mac.cpp @@ -72,8 +72,7 @@ static QCFType<CFTypeRef> searchProperty(io_registry_entry_t ioRegistryEntry, static QString searchStringProperty(io_registry_entry_t ioRegistryEntry, const QCFString &propertyKey) { - const QCFString result(searchProperty(ioRegistryEntry, propertyKey).as<CFStringRef>()); - return QCFString::toQString(result); + return QCFString::toQString(searchProperty(ioRegistryEntry, propertyKey).as<CFStringRef>()); } static quint16 searchShortIntProperty(io_registry_entry_t ioRegistryEntry, |