syncmlfw/ds/dsutils/ProfileUtil/src/NsmlProfileUtil.cpp
changeset 73 ae69c2e8bc34
parent 66 08c8318ec9cb
--- a/syncmlfw/ds/dsutils/ProfileUtil/src/NsmlProfileUtil.cpp	Tue Sep 28 17:53:08 2010 +0530
+++ b/syncmlfw/ds/dsutils/ProfileUtil/src/NsmlProfileUtil.cpp	Fri Oct 15 11:46:45 2010 +0530
@@ -157,9 +157,11 @@
 
     DBG_FILE(_S8("CNsmlProfileUtil::InternalizeFromSettingsDBL, BEGIN"));
     // Read the profile details from settings database
-	CNSmlDSSettings* dsSettings = CNSmlDSSettings::NewL();	       
+	CNSmlDSSettings* dsSettings = CNSmlDSSettings::NewL();	 
+	CleanupStack::PushL(dsSettings);      
 	CNSmlDSProfile* profile = dsSettings->ProfileL( aProfileId );
-	
+	CleanupStack::PushL(profile);  
+		
 	iProfileId = aProfileId;	
 	iDisplayName = 	profile->StrValue( EDSProfileDisplayName ).AllocL();
 	iProtocolVer = static_cast<TSmlProtocolVersion>( profile->IntValue( EDSProfileProtocolVersion ) );	
@@ -178,7 +180,7 @@
 	for ( int i = 0; i < profile->iContentTypes->Count(); i++ ) 
 	{
 	    CNsmlContentData* contentData = CNsmlContentData::NewL();
-	    
+	    CleanupStack::PushL(contentData);  
 	    // From settings DB
 	    CNSmlDSContentType* contentType = static_cast<CNSmlDSContentType*>(profile->iContentTypes->At(i));
 	   
@@ -190,12 +192,13 @@
 	    //SyncType is same for all the contents from UI
 	    iSyncType=static_cast<TSmlSyncType>(contentType->IntValue(EDSAdapterSyncType));
 	    // Add to this object
-	    iContents.AppendL(contentData);			
+	    iContents.AppendL(contentData);		
+	    CleanupStack::Pop(contentData);	
 	}
 	
 	// Cleanup
-	delete profile;
-	delete dsSettings;
+	CleanupStack::PopAndDestroy(profile);
+	CleanupStack::PopAndDestroy(dsSettings);
 	DBG_FILE(_S8("CNsmlProfileUtil::InternalizeFromSettingsDBL, END"));
 }