Compare commits

...

1 Commits
hygon ... i212

Author SHA1 Message Date
Dr-Noob
4ba128ad33 [v1.04][X86] Fix incorrect free in AMD CPUs 2023-12-22 22:53:42 +00:00
2 changed files with 5 additions and 3 deletions

View File

@@ -194,7 +194,7 @@ void init_topology_struct(struct topology* topo, struct cache* cach) {
topo->sockets = 0;
#ifdef ARCH_X86
topo->smt_available = 0;
topo->apic = emalloc(sizeof(struct apic));
topo->apic = ecalloc(1, sizeof(struct apic));
#endif
#endif
}

View File

@@ -1170,8 +1170,10 @@ void print_raw(struct cpuInfo* cpu) {
}
void free_topo_struct(struct topology* topo) {
free(topo->apic->cache_select_mask);
free(topo->apic->cache_id_apic);
if(topo->apic->cache_select_mask != NULL)
free(topo->apic->cache_select_mask);
if(topo->apic->cache_id_apic != NULL)
free(topo->apic->cache_id_apic);
free(topo->apic);
free(topo);
}