usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp
changeset 59 bbdce6bffaad
parent 49 93c0009bd947
child 63 705964cc7132
--- a/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp	Tue Oct 19 14:23:03 2010 +0800
+++ b/usbmgmt/usbmgr/host/functiondrivers/ms/msmm/server/src/eventhandler.cpp	Wed Oct 20 12:04:53 2010 +0800
@@ -148,7 +148,11 @@
     for (TInt index = 0; index < aLogicalUnitCount; index++)
         {
         command = new (ELeave) TRetrieveDriveLetter(parameter, index);
-        iSubCommandQueue.PushL(command);
+
+		CleanupStack::PushL(command);        
+		iSubCommandQueue.PushL(command);
+		CleanupStack::Pop(command);
+
         }
     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORRETRIEVEDRIVELETTERL_EXIT );
     }
@@ -161,7 +165,11 @@
     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
     TMountLogicalUnit* command = new (ELeave) TMountLogicalUnit(
             parameter, aDrive, aLuNumber);
+	
+	CleanupStack::PushL(command);
     iSubCommandQueue.InsertAfterHeadL(command);
+	CleanupStack::Pop(command);
+
     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORMOUNTINGLOGICALUNITL_EXIT );
     }
 
@@ -173,7 +181,11 @@
     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
     TSaveLatestMountInfo* command = 
         new (ELeave) TSaveLatestMountInfo(parameter, aDrive, aLuNumber);
+	
+	CleanupStack::PushL(command);
     iSubCommandQueue.InsertAfterHeadL(command);
+	CleanupStack::Pop(command);
+
     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORSAVELATESTMOUNTINFOL_EXIT );
     }
 
@@ -362,7 +374,11 @@
     
     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
     TRegisterInterface* command = new (ELeave) TRegisterInterface(parameter);
+
+	CleanupStack::PushL(command);
     iSubCommandQueue.PushL(command);
+	CleanupStack::Pop(command);
+
     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORADDINGUSBMSFUNCTIONL_EXIT );
     }
 
@@ -380,7 +396,10 @@
     THostMsSubCommandParam parameter(iServer, *this, *this, iIncomingEvent);
     TRemoveUsbMsDevice* removeMsDevice = new (ELeave) TRemoveUsbMsDevice(
             parameter);
+	
+	CleanupStack::PushL(removeMsDevice);
     iSubCommandQueue.PushL(removeMsDevice);
+	CleanupStack::Pop(removeMsDevice);
     
     OstTraceFunctionExit0( CDEVICEEVENTHANDLER_CREATESUBCMDFORREMOVINGUSBMSDEVICEL_EXIT );
     }