ncneofetch: only free cpu_model if we know we'll replace it

pull/1321/head
nick black 4 years ago
parent 5c5f892b3e
commit fe50c8ba29
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -112,12 +112,12 @@ fetch_cpu_info(fetched_info* fi){
#define VEND "vendor_id"
if(strncmp(buf, TAG, strlen(TAG)) == 0){
// model name trumps vendor_id
free(fi->cpu_model);
char* start = strchr(buf + strlen(TAG), ':');
if(start){
++start;
char* nl = strchr(start, '\n');
*nl = '\0';
free(fi->cpu_model);
fi->cpu_model = strdup(start);
}
}else if(strncmp(buf, VEND, strlen(VEND)) == 0){

Loading…
Cancel
Save