Skip to content

Commit

Permalink
fix ref count
Browse files Browse the repository at this point in the history
  • Loading branch information
donnaskiez committed Jun 17, 2024
1 parent 30fdeb2 commit bbcfa50
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
7 changes: 3 additions & 4 deletions driver/callbacks.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ EnumerateProcessModuleList(_In_ HANDLE ProcessId,
_In_ PROCESS_MODULE_CALLBACK Callback,
_In_opt_ PVOID Context)
{
UINT32 index = 0;
INT32 index = 0;
PRTL_HASHMAP map = GetProcessHashmap();
BOOLEAN ret = FALSE;
PPROCESS_LIST_ENTRY entry = NULL;
Expand Down Expand Up @@ -721,6 +721,8 @@ ThreadCreateNotifyRoutine(_In_ HANDLE ProcessId,
ImpPsLookupThreadByThreadId(ThreadId, &thread);
ImpPsLookupProcessByProcessId(ProcessId, &process);

/* ideally we should dereference the other but this shouldnt really ever
* fail */
if (!thread || !process)
return;

Expand All @@ -732,9 +734,6 @@ ThreadCreateNotifyRoutine(_In_ HANDLE ProcessId,
if (!entry)
goto end;

ImpObfReferenceObject(thread);
ImpObfReferenceObject(process);

entry->thread_id = ThreadId;
entry->thread = thread;
entry->owning_process = process;
Expand Down
8 changes: 4 additions & 4 deletions driver/containers/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ RtlRbTreePrintCurrentStatistics(_In_ PRB_TREE Tree)
* - This stores the size of the objects that will be stored in the tree. It
* is used to allocate memory for the nodes.
* - Lets say each node needs to have a THREAD_LIST_ENTRY object. The
* ObjectSize = sizeof(THREAD_LIST_OBJECT) and in turn will mean each node will
* be of size: sizeof(THREAD_LIST_OBJECT) + sizeof(RB_TREE_NODE). This is also
* this size the lookaside list pools will be set to.
* ObjectSize = sizeof(THREAD_LIST_OBJECT) and in turn will mean each node will
* be of size: sizeof(THREAD_LIST_OBJECT) + sizeof(RB_TREE_NODE). This is also
* this size the lookaside list pools will be set to.
*
* > `LOOKASIDE_LIST_EX pool`:
* - This is a lookaside list that provides a fast, efficient way to allocate
Expand Down Expand Up @@ -552,7 +552,7 @@ RtlpRbTreeTransplant(_In_ PRB_TREE Tree,
}

STATIC
PVOID
PRB_TREE_NODE
RtlpRbTreeFindNode(_In_ PRB_TREE Tree, _In_ PVOID Key)
{
INT32 result = 0;
Expand Down

0 comments on commit bbcfa50

Please sign in to comment.