mirror of https://github.com/xzeldon/htop.git
Ok, second take on fixing the handling of comm.-
This commit is contained in:
parent
adbfe82e63
commit
97ea7a1a8c
|
@ -140,6 +140,7 @@ Process* Process_new(struct ProcessList_ *pl) {
|
||||||
Process* Process_clone(Process* this) {
|
Process* Process_clone(Process* this) {
|
||||||
Process* clone = malloc(sizeof(Process));
|
Process* clone = malloc(sizeof(Process));
|
||||||
memcpy(clone, this, sizeof(Process));
|
memcpy(clone, this, sizeof(Process));
|
||||||
|
this->comm = NULL;
|
||||||
return clone;
|
return clone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -526,10 +526,7 @@ void ProcessList_processEntries(ProcessList* this, char* dirname, int parent, fl
|
||||||
assert(process->pid == pid);
|
assert(process->pid == pid);
|
||||||
} else {
|
} else {
|
||||||
process = prototype;
|
process = prototype;
|
||||||
if (process->comm) {
|
assert(process->comm == NULL);
|
||||||
free(process->comm);
|
|
||||||
process->comm = NULL;
|
|
||||||
}
|
|
||||||
process->pid = pid;
|
process->pid = pid;
|
||||||
if (! ProcessList_readStatusFile(this, process, dirname, name))
|
if (! ProcessList_readStatusFile(this, process, dirname, name))
|
||||||
goto errorReadingProcess;
|
goto errorReadingProcess;
|
||||||
|
@ -611,6 +608,10 @@ void ProcessList_processEntries(ProcessList* this, char* dirname, int parent, fl
|
||||||
errorReadingProcess: {
|
errorReadingProcess: {
|
||||||
if (existingProcess)
|
if (existingProcess)
|
||||||
ProcessList_remove(this, process);
|
ProcessList_remove(this, process);
|
||||||
|
if (process->comm) {
|
||||||
|
free(process->comm);
|
||||||
|
process->comm = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue