mirror of
https://github.com/wolfpld/tracy.git
synced 2024-11-27 00:04:35 +00:00
Merge pull request #60 from nagisa/nagisa/dont-sigsegv-file
Check for null FILE handles in ReportTopology
This commit is contained in:
commit
493d433330
@ -2692,12 +2692,15 @@ void Profiler::ReportTopology()
|
||||
sprintf( path, "%s%i/topology/physical_package_id", basePath, i );
|
||||
char buf[1024];
|
||||
FILE* f = fopen( path, "rb" );
|
||||
if( f == nullptr ) {
|
||||
tracy_free(cpuData);
|
||||
return;
|
||||
}
|
||||
auto read = fread( buf, 1, 1024, f );
|
||||
buf[read] = '\0';
|
||||
fclose( f );
|
||||
cpuData[i].package = uint32_t( atoi( buf ) );
|
||||
cpuData[i].thread = i;
|
||||
|
||||
sprintf( path, "%s%i/topology/core_id", basePath, i );
|
||||
f = fopen( path, "rb" );
|
||||
read = fread( buf, 1, 1024, f );
|
||||
|
Loading…
Reference in New Issue
Block a user