diff --git a/reactos/ntoskrnl/io/iomgr/irp.c b/reactos/ntoskrnl/io/iomgr/irp.c index a578e89731a..bd0eb8881d6 100644 --- a/reactos/ntoskrnl/io/iomgr/irp.c +++ b/reactos/ntoskrnl/io/iomgr/irp.c @@ -1047,14 +1047,12 @@ IoCancelThreadIo(IN PETHREAD Thread) NextEntry = ListHead->Flink; while (ListHead != NextEntry) { - /* Get the IRP */ + /* Get the IRP and move to the next entry */ Irp = CONTAINING_RECORD(NextEntry, IRP, ThreadListEntry); + NextEntry = NextEntry->Flink; /* Cancel it */ IoCancelIrp(Irp); - - /* Move to the next entry */ - NextEntry = NextEntry->Flink; } /* Wait 100 milliseconds */