Commit 8adc7ac0 authored by Hisham Muhammad's avatar Hisham Muhammad
Browse files

Fix asserts, don't use freed memory.

parent 27131192
...@@ -309,12 +309,12 @@ void ProcessList_remove(ProcessList* this, Process* p) { ...@@ -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) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment