mirror of
https://github.com/GOSTSec/ccminer
synced 2025-01-31 00:44:15 +00:00
sysinfos: fix some file leaks
This commit is contained in:
parent
c120ecae1d
commit
9dedec5ecd
6
api.cpp
6
api.cpp
@ -321,8 +321,12 @@ static const char* os_name()
|
|||||||
return "windows";
|
return "windows";
|
||||||
#else
|
#else
|
||||||
FILE *fd = fopen("/proc/version", "r");
|
FILE *fd = fopen("/proc/version", "r");
|
||||||
if (!fd || !fscanf(fd, "Linux version %48s", &os_version[6]))
|
if (!fd)
|
||||||
return "linux";
|
return "linux";
|
||||||
|
if (!fscanf(fd, "Linux version %48s", &os_version[6])) {
|
||||||
|
fclose(fd);
|
||||||
|
return "linux";
|
||||||
|
}
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
os_version[48] = '\0';
|
os_version[48] = '\0';
|
||||||
return (const char*) os_version;
|
return (const char*) os_version;
|
||||||
|
@ -50,8 +50,9 @@ static uint32_t linux_cpufreq(int core)
|
|||||||
return freq;
|
return freq;
|
||||||
|
|
||||||
if (!fscanf(fd, "%d", &freq))
|
if (!fscanf(fd, "%d", &freq))
|
||||||
return freq;
|
;
|
||||||
|
|
||||||
|
fclose(fd);
|
||||||
return freq;
|
return freq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user