From e1c9e3b9ed93da7fa205bd5c4e3590f2a28ba715 Mon Sep 17 00:00:00 2001 From: Chocobo1 Date: Mon, 5 Dec 2016 18:52:21 +0800 Subject: [PATCH] Fix memory leak call unicode version of the function directly --- src/base/utils/fs.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/base/utils/fs.cpp b/src/base/utils/fs.cpp index 361a14680..cd4f355c5 100644 --- a/src/base/utils/fs.cpp +++ b/src/base/utils/fs.cpp @@ -363,8 +363,8 @@ QString Utils::Fs::QDesktopServicesDataLocation() { QString result; #ifdef Q_OS_WIN - LPWSTR path=new WCHAR[256]; - if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE)) + wchar_t path[MAX_PATH + 1] = {L'\0'}; + if (SHGetSpecialFolderPathW(0, path, CSIDL_LOCAL_APPDATA, FALSE)) result = fromNativePath(QString::fromWCharArray(path)); if (!QCoreApplication::applicationName().isEmpty()) result += QLatin1String("/") + qApp->applicationName();