[ros-diffs] [dchapyshev] 39891: - Fix exceptions in some cases (if CriticalSection->DebugInfo = NULL)

dchapyshev at svn.reactos.org dchapyshev at svn.reactos.org
Fri Mar 6 19:03:04 CET 2009


Author: dchapyshev
Date: Fri Mar  6 21:03:04 2009
New Revision: 39891

URL: http://svn.reactos.org/svn/reactos?rev=39891&view=rev
Log:
- Fix exceptions in some cases (if CriticalSection->DebugInfo = NULL)

Modified:
    trunk/reactos/lib/rtl/critical.c

Modified: trunk/reactos/lib/rtl/critical.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/critical.c?rev=39891&r1=39890&r2=39891&view=diff
==============================================================================
--- trunk/reactos/lib/rtl/critical.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/critical.c [iso-8859-1] Fri Mar  6 21:03:04 2009
@@ -358,14 +358,21 @@
     /* Protect List */
     RtlEnterCriticalSection(&RtlCriticalSectionLock);
 
-    /* Remove it from the list */
-    RemoveEntryList(&CriticalSection->DebugInfo->ProcessLocksList);
+    if (CriticalSection->DebugInfo)
+    {
+        /* Remove it from the list */
+        RemoveEntryList(&CriticalSection->DebugInfo->ProcessLocksList);
+        RtlZeroMemory(CriticalSection->DebugInfo, sizeof(RTL_CRITICAL_SECTION_DEBUG));
+    }
 
     /* Unprotect */
     RtlLeaveCriticalSection(&RtlCriticalSectionLock);
 
-    /* Free it */
-    RtlpFreeDebugInfo(CriticalSection->DebugInfo);
+    if (CriticalSection->DebugInfo)
+    {
+        /* Free it */
+        RtlpFreeDebugInfo(CriticalSection->DebugInfo);
+    }
 
     /* Wipe it out */
     RtlZeroMemory(CriticalSection, sizeof(RTL_CRITICAL_SECTION));



More information about the Ros-diffs mailing list