diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-10-21 17:12:30 +0200 |
---|---|---|
committer | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2014-10-22 12:50:43 +0200 |
commit | dd40295c31cacb2560e5c1ac25e217fd497600a3 (patch) | |
tree | ec676a2c9ce72bad1b292686e082895bed35c16f /src/qml/qml | |
parent | 9b965f3fa0899e27667aba4c437206fdf7a14969 (diff) |
Fix a PIDLIST_ABSOLUTE leak in QQmlEngine on Windows
The documentation of SHParseDisplayName doesn't mention that you need
to free the ppidl parameter, but the documentation of the ITEMIDLIST
does mention that you need to ILFree any ITEMIDLIST passed as
PIDLIST_ABSOLUTE.
Reproduced the leak by repeatedly showing and closing the window on
the task's example.
Task-number: QTBUG-41588
Change-Id: I91d08728fc907c59e56ae344a2d12f0865031120
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmlengine.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/qml/qml/qqmlengine.cpp b/src/qml/qml/qqmlengine.cpp index 2b69661c4b..fd8de555af 100644 --- a/src/qml/qml/qqmlengine.cpp +++ b/src/qml/qml/qqmlengine.cpp @@ -2305,8 +2305,12 @@ static inline QString shellNormalizeFileName(const QString &name) return name; #endif TCHAR buffer[MAX_PATH]; - if (!SHGetPathFromIDList(file, buffer)) + bool gotPath = SHGetPathFromIDList(file, buffer); + ILFree(file); + + if (!gotPath) return name; + QString canonicalName = QString::fromWCharArray(buffer); // Upper case drive letter if (canonicalName.size() > 2 && canonicalName.at(1) == QLatin1Char(':')) |