mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-10 09:39:03 -04:00
ncneofetch: only free cpu_model if we know we'll replace it
This commit is contained in:
parent
5c5f892b3e
commit
fe50c8ba29
@ -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…
x
Reference in New Issue
Block a user