From 82805eb232b901d54f9d2271877f17aa53888d79 Mon Sep 17 00:00:00 2001 From: David Blaikie Date: Tue, 21 Oct 2014 00:34:39 +0000 Subject: [PATCH] PR21202: Memory leak in Windows RWMutexImpl when using SRWLOCK git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@220251 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Support/Windows/RWMutex.inc | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/Support/Windows/RWMutex.inc b/lib/Support/Windows/RWMutex.inc index 00d0e93d8d5..2d1d25f67b8 100644 --- a/lib/Support/Windows/RWMutex.inc +++ b/lib/Support/Windows/RWMutex.inc @@ -84,12 +84,10 @@ RWMutexImpl::RWMutexImpl() { } RWMutexImpl::~RWMutexImpl() { - if (sHasSRW) { - // Nothing to do in the case of slim reader/writers - } else { + if (!sHasSRW) DeleteCriticalSection(static_cast(data_)); - free(data_); - } + // Nothing to do in the case of slim reader/writers except free the memory. + free(data_); } bool RWMutexImpl::reader_acquire() { -- 2.34.1