Free the tid buffer when thread enumeration yields nothing.

A task directory yielding no numeric entries (the target exiting
mid-enumeration) returned 0 with the freshly allocated array still
handed back through *out, and the caller's failure path returned without
freeing it.
This commit is contained in:
Bartosz Taudul
2026-08-30 16:30:26 +02:00
parent da0d2328f5
commit e5d20e1377

View File

@@ -457,6 +457,12 @@ static int EnumerateTaskTids( pid_t pid, uint32_t** out )
tids[count++] = (uint32_t)tid;
}
closedir( dir );
if( count == 0 )
{
tracy_free( tids );
*out = nullptr;
return 0;
}
*out = tids;
return (int)count;
}