BUG#: 8559
authorharsha.bm <harsha.bm>
Fri, 24 Jul 2009 05:48:01 +0000 (05:48 +0000)
committerharsha.bm <harsha.bm>
Fri, 24 Jul 2009 05:48:01 +0000 (05:48 +0000)
TITLE: CIMOMHandleQueryContext object is leaking.
DESCRIPTION: CMPI_SelectExp now maintaines its own QueryHandle.it clones it in the costructor and releases it in the destructor.

src/Pegasus/ProviderManager2/CMPI/CMPIProviderManager.cpp
src/Pegasus/ProviderManager2/CMPI/CMPIProviderManager.h
src/Pegasus/ProviderManager2/CMPI/CMPI_BrokerEnc.cpp
src/Pegasus/ProviderManager2/CMPI/CMPI_SelectExp.cpp

index 95e8fc33076f41caa280b08228425236a9e81dfc..6b9023169f1310dbc336e441a75a95f431231b7b 100644 (file)
@@ -159,8 +159,6 @@ CMPIProviderManager::~CMPIProviderManager()
             selxTab.lookup(i.key(), selx);
             if (selx->eSelx)
                 delete selx->eSelx;
-            if (selx->qContext)
-                delete selx->qContext;
             delete selx;
             //Same as above!
             //selxTab.remove(i.key());
@@ -2028,26 +2026,24 @@ Message * CMPIProviderManager::handleCreateSubscriptionRequest(
             request->operationContext.get(
             SubscriptionFilterConditionContainer::NAME);
 
-        CIMOMHandleQueryContext *_context=
-            new CIMOMHandleQueryContext(
+        CIMOMHandleQueryContext _context(
             CIMNamespaceName(
             request->nameSpace.getString()),
             *pr.getCIMOMHandle());
 
         CMPI_SelectExp *eSelx=new CMPI_SelectExp(
             request->operationContext,
-            _context,
+            &_context,
             request->query,
             sub_cntr.getQueryLanguage());
 
         srec->eSelx=eSelx;
-        srec->qContext=_context;
 
         CMPI_ThreadContext thr(pr.getBroker(),&eCtx);
 
         String lang(sub_cntr.getQueryLanguage());
         CString className = _getClassNameFromQuery(
-            _context,
+            &_context,
             request->query,
             lang).getCString();
 
@@ -2185,7 +2181,6 @@ Message * CMPIProviderManager::handleCreateSubscriptionRequest(
             if (--srec->count<=0)
             {
                 selxTab.remove(sPath);
-                delete _context;
                 delete eSelx;
                 delete srec;
             }
@@ -2288,7 +2283,6 @@ Message * CMPIProviderManager::handleDeleteSubscriptionRequest(
         };
 
         CMPI_SelectExp *eSelx=srec->eSelx;
-        CIMOMHandleQueryContext *qContext=srec->qContext;
 
         CString className = eSelx->classNames[0].getClassName().
             getString().getCString();
@@ -2390,7 +2384,6 @@ Message * CMPIProviderManager::handleDeleteSubscriptionRequest(
 
         if (srec->count<=0)
         {
-            delete qContext;
             delete eSelx;
             delete srec;
         }
index 4291762aa2425b2d32bd4e95c1f418298a2b0910..eec6e1c107688aadc45c2241b47fcf7682e9b6bf 100644 (file)
@@ -86,7 +86,6 @@ public:
         {
         }
         CMPI_SelectExp *eSelx;
-        CIMOMHandleQueryContext *qContext;
         int count;
     };
 
index 353fc00c6822ca635f2ea70a4d7934cd6f2e3a63..1934f450e266291815d3d8fe97cb763099dcaca4 100644 (file)
@@ -1658,7 +1658,7 @@ extern "C"
                 CMSetStatus (st, CMPI_RC_OK);
             }
             CMPI_SelectExp* cmpiSelectExp = new CMPI_SelectExp(
-                selectStatement, false, qcontext.clone());
+                selectStatement, false, (QueryContext*) &qcontext);
             PEG_METHOD_EXIT();
             return (cmpiSelectExp);
         }
index 8641bc72260e4283bd97a83f519d3ceb2d15c6dc..6e225bad5d2badb104beccf14f9cdb21450907ea 100644 (file)
@@ -658,13 +658,14 @@ CMPI_SelectExp::~CMPI_SelectExp()
     delete cql_dnf;
     delete cql_stmt;
 #endif
+    delete _context;
 }
 CMPI_SelectExp::CMPI_SelectExp (
     const OperationContext & ct,
     QueryContext * context,
     String cond_,
     String lang_):ctx (ct),cond (cond_),lang (lang_),
-                  _context (context),persistent(true)
+                  _context (context->clone()),persistent(true)
 {
     /**
       We do NOT add ourselves to the CMPI_Object as this is a persitent object.
@@ -710,7 +711,7 @@ CMPI_SelectExp::CMPI_SelectExp (
 #ifdef PEGASUS_ENABLE_CQL
 CMPI_SelectExp::CMPI_SelectExp (CQLSelectStatement * st, Boolean persistent_,
     QueryContext *context):ctx (OperationContext ()),cql_stmt (st),
-    _context(context), persistent (persistent_)
+    _context(context->clone()), persistent (persistent_)
 {
     /** Adding the object to the garbage collector.
     */