Fixed possible memory leak.
This commit is contained in:
parent
ae605d9d1e
commit
b82098a29e
@ -843,13 +843,16 @@ QString MUtils::OS::get_file_path(const int &fd)
|
|||||||
const DWORD len = g_getFilePath_prt(handle, NULL, 0, FILE_NAME_OPENED);
|
const DWORD len = g_getFilePath_prt(handle, NULL, 0, FILE_NAME_OPENED);
|
||||||
if (len > 0)
|
if (len > 0)
|
||||||
{
|
{
|
||||||
wchar_t *const buffer = (wchar_t*) _malloca(sizeof(wchar_t) * len);
|
if (wchar_t *const buffer = (wchar_t*)_malloca(sizeof(wchar_t) * len))
|
||||||
|
{
|
||||||
const DWORD ret = g_getFilePath_prt(handle, buffer, len, FILE_NAME_OPENED);
|
const DWORD ret = g_getFilePath_prt(handle, buffer, len, FILE_NAME_OPENED);
|
||||||
if ((ret > 0) && (ret < len))
|
if ((ret > 0) && (ret < len))
|
||||||
{
|
{
|
||||||
const QString path(MUTILS_QSTR(buffer));
|
const QString path(MUTILS_QSTR(buffer));
|
||||||
return path.startsWith(QLatin1String("\\\\?\\")) ? path.mid(4) : path;
|
return path.startsWith(QLatin1String("\\\\?\\")) ? path.mid(4) : path;
|
||||||
}
|
}
|
||||||
|
_freea(buffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user