policymanagement/policyengine/policyengineserver/src/PolicyEngineServer.cpp
changeset 73 ae69c2e8bc34
parent 66 08c8318ec9cb
equal deleted inserted replaced
71:d2517372cc44 73:ae69c2e8bc34
   699 
   699 
   700 void CPolicyEngineSession::NewSubSessionL( const RMessage2& aMessage)
   700 void CPolicyEngineSession::NewSubSessionL( const RMessage2& aMessage)
   701 	{
   701 	{
   702 	//add new session objects object into container and object index
   702 	//add new session objects object into container and object index
   703 	CPolicyProcessor * policyProcessor = CPolicyProcessor::NewL(); 
   703 	CPolicyProcessor * policyProcessor = CPolicyProcessor::NewL(); 
       
   704 	CleanupStack::PushL(policyProcessor);
   704 	CTrustedSession * trustedSession = CTrustedSession::NewL();
   705 	CTrustedSession * trustedSession = CTrustedSession::NewL();
       
   706 	CleanupStack::PushL(trustedSession);
   705 	trustedSession->AddSessionSIDL( aMessage.SecureId());
   707 	trustedSession->AddSessionSIDL( aMessage.SecureId());
   706 	policyProcessor->SetSessionTrust( trustedSession);
   708 	policyProcessor->SetSessionTrust( trustedSession);
   707 	CPolicyManager * policyManager = NULL;
   709 	CPolicyManager * policyManager = NULL;
   708 	
   710 	
   709  	if ( aMessage.Function() == ECreateManagementSubSession)
   711  	if ( aMessage.Function() == ECreateManagementSubSession)
   710  	{
   712  	{
   711  		policyManager = CPolicyManager::NewL( policyProcessor);
   713  		policyManager = CPolicyManager::NewL( policyProcessor);
       
   714  		CleanupStack::PushL(policyManager);	
   712  	}	
   715  	}	
   713 	
   716 	
   714 	//Create new subsession object for subsession
   717 	//Create new subsession object for subsession
   715 	CSubSessionObjects * subSessionObjects = CSubSessionObjects::NewL( policyProcessor, policyManager, trustedSession); 
   718 	CSubSessionObjects * subSessionObjects = CSubSessionObjects::NewL( policyProcessor, policyManager, trustedSession); 
   716 
   719   CleanupStack::PushL(subSessionObjects);	
       
   720   	
   717 	iContainer->AddL( subSessionObjects);
   721 	iContainer->AddL( subSessionObjects);
   718 	TInt handle = iSessionsObjects->AddL( subSessionObjects);
   722 	TInt handle = iSessionsObjects->AddL( subSessionObjects);
   719 
   723 
   720 	//transmit handle to client 
   724 	//transmit handle to client 
   721 	TPckg<TInt> handlePckg(handle);
   725 	TPckg<TInt> handlePckg(handle);
   722 	TRAPD( r, aMessage.WriteL(3, handlePckg))
   726 	TRAPD( r, aMessage.WriteL(3, handlePckg))
   723 
   727   CleanupStack::Pop(subSessionObjects);
       
   728   if ( policyManager )	
       
   729   	CleanupStack::Pop(policyManager);	
       
   730   CleanupStack::Pop(trustedSession);
       
   731   CleanupStack::Pop(policyProcessor);
       
   732   			
   724 	if ( r != KErrNone)
   733 	if ( r != KErrNone)
   725 	{
   734 	{
   726 		iSessionsObjects->Remove(handle);
   735 		iSessionsObjects->Remove(handle);
   727 		PanicClient( aMessage, EBadDescriptor);
   736 		PanicClient( aMessage, EBadDescriptor);
   728 		return;
   737 		return;