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>
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(':'))