mirror of
https://github.com/Dr-Noob/cpufetch.git
synced 2026-03-25 07:50:40 +01:00
Fix bug and memory leak
This commit is contained in:
@@ -130,6 +130,7 @@ int main(int argc, char* argv[]) {
|
||||
free(cpu);
|
||||
free(art);
|
||||
free_cache_struct(cach);
|
||||
free_topo_struct(topo);
|
||||
free_freq_struct(freq);
|
||||
|
||||
return EXIT_SUCCESS;
|
||||
|
||||
@@ -198,7 +198,7 @@ struct cpuInfo* get_cpu_info() {
|
||||
}
|
||||
|
||||
struct topology* get_topology_info(struct cpuInfo* cpu) {
|
||||
struct topology* topo = malloc(sizeof(struct cache));
|
||||
struct topology* topo = malloc(sizeof(struct topology));
|
||||
uint32_t eax = 0;
|
||||
uint32_t ebx = 0;
|
||||
uint32_t ecx = 0;
|
||||
@@ -703,6 +703,10 @@ void print_levels(struct cpuInfo* cpu, char* cpu_name) {
|
||||
printf("- Max extended level: 0x%.8X\n", cpu->maxExtendedLevels);
|
||||
}
|
||||
|
||||
void free_topo_struct(struct topology* topo) {
|
||||
free(topo);
|
||||
}
|
||||
|
||||
void free_cache_struct(struct cache* cach) {
|
||||
free(cach);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ void print_levels(struct cpuInfo* cpu, char* cpu_name);
|
||||
|
||||
void free_cpuinfo_struct(struct cpuInfo* cpu);
|
||||
void free_cache_struct(struct cache* cach);
|
||||
void free_topo_struct(struct topology* topo);
|
||||
void free_freq_struct(struct frequency* freq);
|
||||
|
||||
void debug_cpu_info(struct cpuInfo* cpu);
|
||||
|
||||
Reference in New Issue
Block a user