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

This commit is contained in:
nick black 2021-01-21 23:51:33 -05:00
parent 5c5f892b3e
commit fe50c8ba29
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

View File

@ -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){