From 64455e3b04559c229008adf23dbdcba07a5dcb60 Mon Sep 17 00:00:00 2001 From: Dmitry Chapyshev Date: Fri, 6 Mar 2009 18:03:04 +0000 Subject: [PATCH] - Fix exceptions in some cases (if CriticalSection->DebugInfo = NULL) svn path=/trunk/; revision=39891 --- reactos/lib/rtl/critical.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/reactos/lib/rtl/critical.c b/reactos/lib/rtl/critical.c index da7314429a1..884a45c66d8 100644 --- a/reactos/lib/rtl/critical.c +++ b/reactos/lib/rtl/critical.c @@ -358,14 +358,21 @@ RtlDeleteCriticalSection(PRTL_CRITICAL_SECTION CriticalSection) /* 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));