https://git.reactos.org/?p=reactos.git;a=commitdiff;h=f555c102b79f675c57118…
commit f555c102b79f675c571187c84a54b76b5bd9e652
Author: Timo Kreuzer <timo.kreuzer(a)reactos.org>
AuthorDate: Sun Oct 22 10:57:40 2017 +0200
[NTOS:EX] Don't dereference ExpCritSecOutOfMemoryEvent when it was never
referenced.
---
ntoskrnl/ex/keyedevt.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/ntoskrnl/ex/keyedevt.c b/ntoskrnl/ex/keyedevt.c
index 6bb2769e34..110b2c3ee7 100644
--- a/ntoskrnl/ex/keyedevt.c
+++ b/ntoskrnl/ex/keyedevt.c
@@ -457,8 +457,11 @@ NtWaitForKeyedEvent(
/* Do the wait */
Status = ExpWaitForKeyedEvent(KeyedEvent, Key, Alertable, Timeout);
- /* Dereference the keyed event */
- ObDereferenceObject(KeyedEvent);
+ if (Handle != NULL)
+ {
+ /* Dereference the keyed event */
+ ObDereferenceObject(KeyedEvent);
+ }
/* Return the status */
return Status;
@@ -523,8 +526,11 @@ NtReleaseKeyedEvent(
/* Do the wait */
Status = ExpReleaseKeyedEvent(KeyedEvent, Key, Alertable, Timeout);
- /* Dereference the keyed event */
- ObDereferenceObject(KeyedEvent);
+ if (Handle != NULL)
+ {
+ /* Dereference the keyed event */
+ ObDereferenceObject(KeyedEvent);
+ }
/* Return the status */
return Status;