From: Jocelyn Turcotte Date: Mon, 24 Jul 2017 13:11:30 +0000 (+0200) Subject: windows: Fix a memory leak in FileSystem::longWinPath X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~704^2^2~19 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=5a1bf7d8feb1900fd93ca4f9c613cef4c9cbff93;p=nextcloud-desktop.git windows: Fix a memory leak in FileSystem::longWinPath Also use c_path_to_UNC directly instead of doing an extra UTF-8->wchar conversion. --- diff --git a/src/libsync/filesystem.cpp b/src/libsync/filesystem.cpp index c068f4694..18e6f800f 100644 --- a/src/libsync/filesystem.cpp +++ b/src/libsync/filesystem.cpp @@ -54,12 +54,14 @@ Q_LOGGING_CATEGORY(lcFileSystem, "sync.filesystem", QtInfoMsg) QString FileSystem::longWinPath(const QString &inpath) { - QString path(inpath); - #ifdef Q_OS_WIN - path = QString::fromWCharArray(static_cast(c_utf8_path_to_locale(inpath.toUtf8()))); -#endif + const char *unc_str = c_path_to_UNC(inpath.toUtf8()); + QString path = QString::fromUtf8(unc_str); + free((void*)unc_str); return path; +#else + return inpath; +#endif } bool FileSystem::fileEquals(const QString &fn1, const QString &fn2)