Fix handle use after free

This commit is contained in:
Ali Mashtizadeh 2023-09-05 21:20:02 -04:00
parent fde5d543a6
commit b508aaca27

View File

@ -33,12 +33,12 @@ void
Handle_Destroy(Process *proc)
{
int i;
Handle *handle;
Handle *handle, *handle_tmp;
for (i = 0; i < PROCESS_HANDLE_SLOTS; i++) {
TAILQ_FOREACH(handle, &proc->handles[i], handleList) {
(handle->close)(handle);
TAILQ_FOREACH_SAFE(handle, &proc->handles[i], handleList, handle_tmp) {
TAILQ_REMOVE(&proc->handles[i], handle, handleList);
(handle->close)(handle);
}
}
}