librdmacm: allow for graceful cleanup of verbs
[mirror/winof/.git] / ulp / librdmacm / src / cma_main.cpp
index 3521018..0084633 100644 (file)
@@ -31,6 +31,7 @@
 #include "cma.h"\r
 \r
 CRITICAL_SECTION lock;\r
+HANDLE heap;\r
 \r
 BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)\r
 {\r
@@ -39,10 +40,15 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
 \r
        switch (dwReason) {\r
        case DLL_PROCESS_ATTACH:\r
+               heap = HeapCreate(0, 0, 0);\r
+               if (heap == NULL) {\r
+                       return FALSE;\r
+               }\r
                InitializeCriticalSection(&lock);\r
                break;\r
        case DLL_PROCESS_DETACH:\r
                DeleteCriticalSection(&lock);\r
+               HeapDestroy(heap);\r
                break;\r
        default:\r
                break;\r