Leak, returned value from GetThreadDescription not freed

This commit is contained in:
Sergio Acereda 2024-11-19 14:24:50 +01:00
parent e756fa75cf
commit b9ee0d3b4c

View File

@ -498,11 +498,11 @@ void SysTraceGetExternalName( uint64_t thread, const char*& threadName, const ch
if( _GetThreadDescription ) if( _GetThreadDescription )
{ {
PWSTR tmp; PWSTR tmp;
_GetThreadDescription( hnd, &tmp ); if ( SUCCEEDED( _GetThreadDescription( hnd, &tmp ) ) )
char buf[256];
if( tmp )
{ {
char buf[256];
auto ret = wcstombs( buf, tmp, 256 ); auto ret = wcstombs( buf, tmp, 256 );
LocalFree(tmp);
if( ret != 0 ) if( ret != 0 )
{ {
threadName = CopyString( buf, ret ); threadName = CopyString( buf, ret );