Fix handle use after free
This commit is contained in:
parent
fde5d543a6
commit
b508aaca27
@ -33,12 +33,12 @@ void
|
|||||||
Handle_Destroy(Process *proc)
|
Handle_Destroy(Process *proc)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Handle *handle;
|
Handle *handle, *handle_tmp;
|
||||||
|
|
||||||
for (i = 0; i < PROCESS_HANDLE_SLOTS; i++) {
|
for (i = 0; i < PROCESS_HANDLE_SLOTS; i++) {
|
||||||
TAILQ_FOREACH(handle, &proc->handles[i], handleList) {
|
TAILQ_FOREACH_SAFE(handle, &proc->handles[i], handleList, handle_tmp) {
|
||||||
(handle->close)(handle);
|
|
||||||
TAILQ_REMOVE(&proc->handles[i], handle, handleList);
|
TAILQ_REMOVE(&proc->handles[i], handle, handleList);
|
||||||
|
(handle->close)(handle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user