diff --git a/src/arm/midr.c b/src/arm/midr.c index 8391147..b9d2289 100644 --- a/src/arm/midr.c +++ b/src/arm/midr.c @@ -48,6 +48,7 @@ struct cache* get_cache_info(struct cpuInfo* cpu) { cach->max_cache_level = 2; for(int i=0; i < cach->max_cache_level + 1; i++) { cach->cach_arr[i]->exists = true; + cach->cach_arr[i]->num_caches = 1; cach->cach_arr[i]->size = 0; } diff --git a/src/common/cpu.c b/src/common/cpu.c index c622248..8b0b7e0 100755 --- a/src/common/cpu.c +++ b/src/common/cpu.c @@ -150,12 +150,15 @@ char* get_str_freq(struct frequency* freq) { uint32_t size = (4+3+1); assert(strlen(STRING_UNKNOWN)+1 <= size); char* string = malloc(sizeof(char)*size); + memset(string, 0, sizeof(char)*size); + if(freq->max == UNKNOWN_FREQ) snprintf(string,strlen(STRING_UNKNOWN)+1,STRING_UNKNOWN); else if(freq->max >= 1000) snprintf(string,size,"%.2f"STRING_GIGAHERZ,(float)(freq->max)/1000); else - snprintf(string,size,"%.2f"STRING_MEGAHERZ,(float)(freq->max)); + snprintf(string,size,"%lld"STRING_MEGAHERZ,freq->max); + return string; } diff --git a/src/common/printer.c b/src/common/printer.c index 81097d6..dc093a3 100644 --- a/src/common/printer.c +++ b/src/common/printer.c @@ -563,13 +563,7 @@ bool print_cpufetch_arm(struct ascii* art, struct cpuInfo* cpu, struct colors* c setAttribute(art,ATTRIBUTE_L2,l2); if(l3 != NULL) { setAttribute(art,ATTRIBUTE_L3,l3); - free(l3); } - - free(max_frequency); - free(l1i); - free(l1d); - free(l2); } else { struct cpuInfo* ptr = cpu; diff --git a/src/common/udev.c b/src/common/udev.c index d790d05..87c53df 100644 --- a/src/common/udev.c +++ b/src/common/udev.c @@ -129,6 +129,7 @@ int get_ncores_from_cpuinfo() { char* tmp1 = strstr(buf, "-") + 1; char* tmp2 = strstr(buf, "\n"); char ncores_str[offset]; + memset(ncores_str, 0, sizeof(char) * offset); memcpy(ncores_str, tmp1, tmp2-tmp1); char* end;