BUG#: 8184
authora.rachapudi <a.rachapudi>
Thu, 4 Dec 2008 08:56:31 +0000 (08:56 +0000)
committera.rachapudi <a.rachapudi>
Thu, 4 Dec 2008 08:56:31 +0000 (08:56 +0000)
TITLE: WMI Mapper seems to have memory leaks
DESCRIPTION: Fixed the memory leak in WMI Mapper

src/WMIMapper/WMIProvider/WMICollector.cpp

index b3c13e84e124ab8c386730e7708da59c8c2a4aad..db717ca6f16731fa40e90a7c3daf3a7f8ed5031f 100644 (file)
@@ -88,6 +88,7 @@ void WMICollector::terminate(void)
 bool WMICollector::setup()
 {
     HRESULT hr;
+    static bool bCallInitSec = true;
 
     PEG_METHOD_ENTER(TRC_WMIPROVIDER,"WMICollector::setup()");
 
@@ -102,12 +103,17 @@ bool WMICollector::setup()
 
         if (m_bInitialized)
         {
-            hr = CoInitializeSecurity(NULL, -1, NULL, NULL,
-                                      RPC_C_AUTHN_LEVEL_DEFAULT,
-                                      RPC_C_IMP_LEVEL_IMPERSONATE,
-                                      NULL,
-                                      EOAC_DYNAMIC_CLOAKING,
-                                      0);
+                                      
+            if (bCallInitSec)
+            {
+                bCallInitSec = false;
+                hr = CoInitializeSecurity(NULL, -1, NULL, NULL,
+                        RPC_C_AUTHN_LEVEL_DEFAULT,
+                        RPC_C_IMP_LEVEL_IMPERSONATE,
+                        NULL,
+                        EOAC_DYNAMIC_CLOAKING,
+                        0);
+            }
         }
     }