harvester/monitorplugins/mmcplugin/src/mmcmounttaskao.cpp
branchRCL_3
changeset 47 b73252188534
parent 15 3cebc1a84278
child 49 f23c07ec56e2
--- a/harvester/monitorplugins/mmcplugin/src/mmcmounttaskao.cpp	Thu Jul 15 19:07:24 2010 +0300
+++ b/harvester/monitorplugins/mmcplugin/src/mmcmounttaskao.cpp	Thu Aug 19 10:20:41 2010 +0300
@@ -79,6 +79,7 @@
 	iHarvestEntryArray.Close();
 	
 	delete iMdeSession;
+	iMdeSession = NULL;
   
 	Deinitialize();
 	
@@ -88,6 +89,7 @@
 		}
 	
 	delete iMmcFileList;
+	iMmcFileList = NULL;
 	iHdArray.ResetAndDestroy();
 	iHdArray.Close();
 	}
@@ -108,17 +110,19 @@
 	iHarvesterPluginFactory = aPluginFactory;
 	}
 	
-void CMMCMountTaskAO::StartMount( TMountData& aMountData )
+void CMMCMountTaskAO::StartMountL( TMountData& aMountData )
 	{
 	WRITELOG("CMMCMountTaskAO::StartMount");
-	iMountDataQueue.Append( &aMountData );
+	
+	User::LeaveIfError( iMountDataQueue.Append( &aMountData ));
+	
 	if ( iNextRequest == ERequestIdle )
 		{
 		SetNextRequest( ERequestStartTask );
 		}
 	}
 	
-void CMMCMountTaskAO::StartUnmount(TMountData& aMountData)
+void CMMCMountTaskAO::StartUnmountL(TMountData& aMountData)
 	{
 	WRITELOG("CMMCMountTaskAO::StartUnmount");
 	
@@ -132,7 +136,8 @@
 			}
 		}
 		
-	iMountDataQueue.Append( &aMountData );
+	User::LeaveIfError( iMountDataQueue.Append( &aMountData ));
+		
 	SetNextRequest( ERequestStartTask );
 	}
 	
@@ -146,7 +151,10 @@
 		{
 		if ( iMountData )
 			{
-			iMountDataQueue.Insert( iMountData, 0 );
+			if( iMountDataQueue.Insert( iMountData, 0 ) != KErrNone)
+			    {
+                delete iMountData;
+			    }
 			iMountData = NULL;
 			}
 		Deinitialize();
@@ -205,7 +213,11 @@
 			TRAPD( err, iMmcFileList->BuildFileListL( iFs, iMountData->iDrivePath, iEntryArray ));
 			if ( err == KErrNoMemory )
 				{
-				iMountDataQueue.Insert( iMountData, 0 );
+				if( iMountDataQueue.Insert( iMountData, 0 ) != KErrNone)
+				    {
+                    delete iMountData;
+				    }
+					
 				iMountData = NULL;
 				Deinitialize();
 				SetNextRequest( ERequestStartTask );
@@ -284,9 +296,14 @@
 					{
 					if( err == KErrNoMemory )
 						{
-						iMountDataQueue.Insert( iMountData, 0 );
+						if(iMountDataQueue.Insert( iMountData, 0 ) != KErrNone)
+						    {
+                            delete iMountData;
+						    }
+							
 						iMountData = NULL;
 						}
+						
 					Deinitialize();
 					SetNextRequest( ERequestStartTask );
 					break;
@@ -437,6 +454,7 @@
 			hd->SetEventType( EHarvesterEdit );
 			hd->SetObjectType( ENormal );
 			delete ei;
+			ei = NULL;
 			}
 		else
 			{
@@ -445,7 +463,12 @@
 			hd->SetClientData( ei );
 			}
 		
-		iHdArray.Append( hd );
+		if(iHdArray.Append( hd ) != KErrNone )
+		    {
+            delete hd;
+            hd = NULL;
+		    }
+			
 		aArray.Remove( i );
 		}