mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 02:32:57 +00:00
Fix part two of the bug:
The actual problem was that we'd overrun the end of the handle count array when decrementing. This also led to a handle leak (observed). Stop correctly when we find the handle we want. svn path=/trunk/; revision=28415
This commit is contained in:
parent
edceb16713
commit
7acf61114d
1 changed files with 5 additions and 0 deletions
|
@ -331,6 +331,8 @@ ObpIncrementHandleDataBase(IN POBJECT_HEADER ObjectHeader,
|
||||||
/* Insert a new entry */
|
/* Insert a new entry */
|
||||||
FreeEntry = ObpInsertHandleCount(ObjectHeader);
|
FreeEntry = ObpInsertHandleCount(ObjectHeader);
|
||||||
if (!FreeEntry) return STATUS_INSUFFICIENT_RESOURCES;
|
if (!FreeEntry) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
ASSERT(!FreeEntry->Process);
|
||||||
|
ASSERT(!FreeEntry->HandleCount);
|
||||||
|
|
||||||
/* Fill it out */
|
/* Fill it out */
|
||||||
FreeEntry->Process = Process;
|
FreeEntry->Process = Process;
|
||||||
|
@ -375,6 +377,8 @@ ObpIncrementHandleDataBase(IN POBJECT_HEADER ObjectHeader,
|
||||||
/* Allocate one */
|
/* Allocate one */
|
||||||
FreeEntry = ObpInsertHandleCount(ObjectHeader);
|
FreeEntry = ObpInsertHandleCount(ObjectHeader);
|
||||||
if (!FreeEntry) return STATUS_INSUFFICIENT_RESOURCES;
|
if (!FreeEntry) return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
|
ASSERT(!FreeEntry->Process);
|
||||||
|
ASSERT(!FreeEntry->HandleCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fill out the entry */
|
/* Fill out the entry */
|
||||||
|
@ -533,6 +537,7 @@ ObpDecrementHandleCount(IN PVOID ObjectBody,
|
||||||
{
|
{
|
||||||
/* Found it, get the process handle count */
|
/* Found it, get the process handle count */
|
||||||
ProcessHandleCount = HandleEntry->HandleCount--;
|
ProcessHandleCount = HandleEntry->HandleCount--;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Keep looping */
|
/* Keep looping */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue