mirror of https://github.com/xzeldon/htop.git
Fix asserts, don't use freed memory.
This commit is contained in:
parent
2713119249
commit
8adc7ac00f
|
@ -309,12 +309,12 @@ void ProcessList_remove(ProcessList* this, Process* p) {
|
||||||
assert(Vector_indexOf(this->processes, p, Process_pidCompare) != -1);
|
assert(Vector_indexOf(this->processes, p, Process_pidCompare) != -1);
|
||||||
assert(Hashtable_get(this->processTable, p->pid) != NULL);
|
assert(Hashtable_get(this->processTable, p->pid) != NULL);
|
||||||
Process* pp = Hashtable_remove(this->processTable, p->pid);
|
Process* pp = Hashtable_remove(this->processTable, p->pid);
|
||||||
assert(pp == p);
|
assert(pp == p); (void)pp;
|
||||||
|
int pid = p->pid;
|
||||||
int index = Vector_indexOf(this->processes, p, Process_pidCompare);
|
int index = Vector_indexOf(this->processes, p, Process_pidCompare);
|
||||||
assert(index != -1);
|
assert(index != -1);
|
||||||
Vector_remove(this->processes, index);
|
Vector_remove(this->processes, index);
|
||||||
assert(Vector_indexOf(this->processes, p, Process_pidCompare) == -1);
|
assert(Hashtable_get(this->processTable, pid) == NULL); (void)pid;
|
||||||
assert(Hashtable_get(this->processTable, p->pid) == NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Process* ProcessList_get(ProcessList* this, int index) {
|
Process* ProcessList_get(ProcessList* this, int index) {
|
||||||
|
|
Loading…
Reference in New Issue