landmarks/locationlandmarks/server/src/EPos_CPosLmNameIndex.cpp
branchRCL_3
changeset 21 6b6920c56e2f
parent 20 2b4ea9893b66
--- a/landmarks/locationlandmarks/server/src/EPos_CPosLmNameIndex.cpp	Tue Aug 31 15:37:04 2010 +0300
+++ b/landmarks/locationlandmarks/server/src/EPos_CPosLmNameIndex.cpp	Wed Sep 01 12:24:21 2010 +0100
@@ -329,10 +329,10 @@
                 // the original item has been changed
                 item->SetInvalid();
                 }
+            
+			CleanupStack::Pop( name );//ownership of name is transferred in the call to DoInsertL
 			
-			CleanupStack::Pop( name );//ownership of name is transferred in the call to DoInsertL	
-				
-            // add new item for this ID
+			// add new item for this ID
             // here comparison must be done using collation
             CIndexItem* newItem = DoInsertL( id, name ); // takes onwership of name
             newItem->SetValid();
@@ -442,7 +442,7 @@
 void CPosLmNameIndex::InsertL( TPosLmItemId aLmid, const TDesC& aName )
     {
     HBufC* name = aName.AllocLC();
-    CleanupStack::Pop( name );
+    CleanupStack::Pop( name );//ownership of name is transferred in the call to UpdateL/InsertL
     InsertL( aLmid, name );
     }
 
@@ -461,14 +461,15 @@
 //
 CPosLmNameIndex::CIndexItem* CPosLmNameIndex::DoInsertL( TPosLmItemId aLmid, HBufC* aName )
     {
-	CleanupStack::PushL( aName );//ownership of aName is transferred to this class
-    if ( Find( aLmid ) >= 0 ) // finds valid item
+    CleanupStack::PushL( aName );//ownership of aName is transferred to this class
+	if ( Find( aLmid ) >= 0 ) // finds valid item
         {
         User::Leave( KErrAlreadyExists ); // duplicate ID found
         }
     
     CIndexItem* landmark = new (ELeave) CIndexItem( aLmid, aName ); // takes ownership of aName
-    CleanupStack::Pop( aName );
+    
+	CleanupStack::Pop( aName );
 	CleanupStack::PushL( landmark );
     
     TLmIndexNameKey key;
@@ -495,8 +496,8 @@
 	CleanupStack::PushL( aName );
     CIndexItem* landmark = new (ELeave) CIndexItem( aLmid, aName );
     CleanupStack::Pop( aName );
-
-    CleanupStack::PushL( landmark );
+	
+	CleanupStack::PushL( landmark );
     AppendL( landmark );
     CleanupStack::Pop( landmark );
     }
@@ -550,7 +551,7 @@
 void CPosLmNameIndex::UpdateL( TPosLmItemId aId, const TDesC& aName )
     {
     HBufC* name = aName.AllocLC();
-	CleanupStack::Pop( name );//ownership of name is transferred in the call to UpdateL
+    CleanupStack::Pop( name );//ownership of name is transferred in the call to UpdateL
 //coverity[freed_arg : FALSE]
     UpdateL( aId, name );
 //coverity[pass_freed_arg : FALSE]