diff --git a/src/arm/midr.c b/src/arm/midr.c index e62fb0d..5e0d780 100644 --- a/src/arm/midr.c +++ b/src/arm/midr.c @@ -80,7 +80,7 @@ struct topology* get_topology_info(struct cpuInfo* cpu, struct cache* cach, uint int cores_in_socket = 0; while(socket_idx + 1 > sockets_seen) { - if(midr_array[first_core_idx] == midr_array[currrent_core_idx] && currrent_core_idx < ncores) { + if(currrent_core_idx < ncores && midr_array[first_core_idx] == midr_array[currrent_core_idx]) { currrent_core_idx++; cores_in_socket++; } @@ -349,9 +349,10 @@ char* get_str_peak_performance(struct cpuInfo* cpu) { char* get_str_features(struct cpuInfo* cpu) { struct features* feat = cpu->feat; - char* string = malloc(sizeof(char) * 25); + uint32_t max_len = strlen("NEON,SHA1,SHA2,AES,CRC32,") + 1; uint32_t len = 0; - + char* string = calloc(max_len, sizeof(char)); + if(feat->NEON) { strcat(string, "NEON,"); len += 5;