commsfwsupport/commselements/commsfw/src/cfutil.cpp
changeset 25 e53adc4c49de
parent 0 dfb7c4ff071f
child 48 07656293a99c
--- a/commsfwsupport/commselements/commsfw/src/cfutil.cpp	Fri Apr 16 16:15:03 2010 +0300
+++ b/commsfwsupport/commselements/commsfw/src/cfutil.cpp	Mon May 03 13:39:24 2010 +0300
@@ -438,6 +438,7 @@
 		{
 		do 
 			{
+			CleanupStack::PushL(dir);
 			const TInt cnt = dir->Count();
 			for(TInt i = 0; i < cnt; ++i)
 				{
@@ -445,7 +446,7 @@
 				fullEntry.Set(entry.iName, &ff.File(), NULL);      
 				AddL(TOwnEntry(fullEntry, entry));
 				}
-			delete dir;
+			CleanupStack::PopAndDestroy(dir);
 			}
 		while(ff.FindWild(dir) == KErrNone);
 		}	
@@ -469,46 +470,46 @@
 	TParse fullEntry;
 	CDir* dir;
 	RArray<TEntry> files;
+	CleanupClosePushL(files);
 	TBool found;
 	if(ff.FindWildByDir(aFileMask, aDir, dir) == KErrNone)
 		{
 		do 
 			{
+			CleanupStack::PushL(dir);
 			const TInt cnt = dir->Count();
 			for(TInt i = 0; i < cnt; ++i)
 				{
 				const TEntry& entry = (*dir)[i];
-		               if(files.Count()!=0)
-				      {
+				if(files.Count()!=0)
+					{
 					found = EFalse;
 					for( TInt Index=0;Index<files.Count();Index++)
-			    	           {
+						{
 						if(files[Index].iName.CompareF(entry.iName)==0)
-						     {
+							{
 							found = ETrue;
-					             }
-				             }
-	                            if(!found)
-	    	                         {
-				    	   files.Append(entry);
-					   fullEntry.Set(entry.iName, &ff.File(), NULL);      
-					   AddL(TOwnEntry(fullEntry, entry));
-				    	     }
-				       }
-		        	else
-			          {
-			           files.Append(entry);
+							}
+						}
+					if(!found)
+						{
+						files.Append(entry);
+						fullEntry.Set(entry.iName, &ff.File(), NULL);      
+						AddL(TOwnEntry(fullEntry, entry));
+						}
+					}
+				else
+					{
+					files.Append(entry);
 				    fullEntry.Set(entry.iName, &ff.File(), NULL);      
 				    AddL(TOwnEntry(fullEntry, entry));
-				    }		
-							
-		         }
-		     delete dir;
-			
-	           }
-	           while(ff.FindWild(dir) == KErrNone);
-        	}	
-	files.Close();	
+				    }
+				}
+				CleanupStack::PopAndDestroy(dir);
+			}
+		while(ff.FindWild(dir) == KErrNone);
+		}	
+	CleanupStack::PopAndDestroy(&files);
 	fs.Pop();
 	}