[RTL] Fix failure check in RtlpCreateCriticalSectionSem.
[reactos.git] / sdk / lib / rtl / critical.c
index ff0d1a9..1f247f5 100644 (file)
@@ -80,7 +80,7 @@ RtlpCreateCriticalSectionSem(PRTL_CRITICAL_SECTION CriticalSection)
                                                NULL) != NULL)
         {
             /* Someone else just created an event */
-            if (hEvent != INVALID_HANDLE_VALUE)
+            if (hNewEvent != INVALID_HANDLE_VALUE)
             {
                 DPRINT("Closing already created event: %p\n", hNewEvent);
                 NtClose(hNewEvent);