winverbs: delete critical sections when no longer needed
authorport.2.tmp <port.2.tmp@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Fri, 15 Jan 2010 17:14:46 +0000 (17:14 +0000)
committerport.2.tmp <port.2.tmp@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Fri, 15 Jan 2010 17:14:46 +0000 (17:14 +0000)
To avoid leaking memory, we need to call DeleteCriticalSection
for all critical sections once they are no longer needed.

Signed-off-by: Sean Hefty <sean.hefty@intel.com>
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@2669 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/winmad/user/wm_provider.cpp
core/winverbs/user/wv_base.cpp
ulp/libibumad/src/umad.cpp
ulp/netdirect/user/nd_adapter.cpp

index 96c20da..b0adc07 100644 (file)
@@ -64,6 +64,8 @@ CWMProvider::~CWMProvider()
                CloseHandle(m_OverlapWrite.hEvent);\r
        }\r
        CloseHandle(m_hFile);\r
+       DeleteCriticalSection(&m_CritSecRead);\r
+       DeleteCriticalSection(&m_CritSecWrite);\r
        InterlockedDecrement(&WmRef);\r
 }\r
 \r
index 52e9b6e..5ed4e9f 100644 (file)
@@ -47,6 +47,7 @@ CWVBase::~CWVBase()
        if (m_Overlap.hEvent != NULL) {\r
                CloseHandle(m_Overlap.hEvent);\r
        }\r
+       DeleteCriticalSection(&m_CritSec);\r
 }\r
 \r
 STDMETHODIMP CWVBase::\r
index 6204be0..62473e3 100644 (file)
@@ -68,6 +68,7 @@ int umad_init(void)
 __declspec(dllexport)\r
 int umad_done(void)\r
 {\r
+       DeleteCriticalSection(&crit_sec);\r
        return 0;\r
 }\r
 \r
index 107a44e..805f77b 100644 (file)
@@ -96,6 +96,7 @@ CNDAdapter::~CNDAdapter(void)
                m_pWvProvider->Release();\r
        }\r
        m_pProvider->Release();\r
+       DeleteCriticalSection(&m_Lock);\r
 }\r
 \r
 STDMETHODIMP CNDAdapter::\r