diff -r d2517372cc44 -r ae69c2e8bc34 policymanagement/policyengine/policyengineserver/src/PolicyEngineServer.cpp --- a/policymanagement/policyengine/policyengineserver/src/PolicyEngineServer.cpp Tue Sep 28 17:53:08 2010 +0530 +++ b/policymanagement/policyengine/policyengineserver/src/PolicyEngineServer.cpp Fri Oct 15 11:46:45 2010 +0530 @@ -701,7 +701,9 @@ { //add new session objects object into container and object index CPolicyProcessor * policyProcessor = CPolicyProcessor::NewL(); + CleanupStack::PushL(policyProcessor); CTrustedSession * trustedSession = CTrustedSession::NewL(); + CleanupStack::PushL(trustedSession); trustedSession->AddSessionSIDL( aMessage.SecureId()); policyProcessor->SetSessionTrust( trustedSession); CPolicyManager * policyManager = NULL; @@ -709,18 +711,25 @@ if ( aMessage.Function() == ECreateManagementSubSession) { policyManager = CPolicyManager::NewL( policyProcessor); + CleanupStack::PushL(policyManager); } //Create new subsession object for subsession CSubSessionObjects * subSessionObjects = CSubSessionObjects::NewL( policyProcessor, policyManager, trustedSession); - + CleanupStack::PushL(subSessionObjects); + iContainer->AddL( subSessionObjects); TInt handle = iSessionsObjects->AddL( subSessionObjects); //transmit handle to client TPckg handlePckg(handle); TRAPD( r, aMessage.WriteL(3, handlePckg)) - + CleanupStack::Pop(subSessionObjects); + if ( policyManager ) + CleanupStack::Pop(policyManager); + CleanupStack::Pop(trustedSession); + CleanupStack::Pop(policyProcessor); + if ( r != KErrNone) { iSessionsObjects->Remove(handle);