mirror of
https://github.com/wolfpld/tracy.git
synced 2025-03-20 07:40:02 +08:00
Fix memory leak when call GetThreadDescription
This commit is contained in:
parent
27ac89547d
commit
263f378afc
@ -219,12 +219,15 @@ TRACY_API const char* GetThreadName( uint32_t id )
|
|||||||
if( hnd != 0 )
|
if( hnd != 0 )
|
||||||
{
|
{
|
||||||
PWSTR tmp;
|
PWSTR tmp;
|
||||||
_GetThreadDescription( hnd, &tmp );
|
if ( SUCCEEDED( _GetThreadDescription( hnd, &tmp ) ) )
|
||||||
auto ret = wcstombs( buf, tmp, 256 );
|
|
||||||
CloseHandle( hnd );
|
|
||||||
if( ret != static_cast<std::size_t>(-1) )
|
|
||||||
{
|
{
|
||||||
return buf;
|
auto ret = wcstombs( buf, tmp, 256 );
|
||||||
|
CloseHandle( hnd );
|
||||||
|
LocalFree( tmp );
|
||||||
|
if( ret != static_cast<std::size_t>(-1) )
|
||||||
|
{
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user