upnpavcontrolpoint/avcpengine/src/upnpbrowsecommand.cpp
changeset 34 eab116a48b80
parent 0 7f85d04be362
--- a/upnpavcontrolpoint/avcpengine/src/upnpbrowsecommand.cpp	Tue Sep 21 11:21:11 2010 +0300
+++ b/upnpavcontrolpoint/avcpengine/src/upnpbrowsecommand.cpp	Mon Oct 04 13:32:20 2010 +0300
@@ -148,15 +148,26 @@
 	//ASSERT(aMessage.Function() == EDownloadDirList);
 
      TInt size = iResult.Count();
-      TFileInfo* dirs = new  TFileInfo[size];
+     TFileInfo* dirs = new  TFileInfo[size];
+     CleanupStack::PushL(TCleanupItem(CleanupArray, dirs));
       for (TInt i = 0; i < size; i++) 
       	{
          dirs[i] = iResult[i];
       	}
       TPtr8 result(reinterpret_cast<TUint8*>(dirs), sizeof(TFileInfo)*size, sizeof(TFileInfo)*size);          
       aMessage.WriteL(1, result);  
-      delete[] dirs;
+	  CleanupStack::PopAndDestroy(dirs);
 	}
+	
+// -----------------------------------------------------------------------------
+// CUpnpBrowseCommand::CleanupArray
+// -----------------------------------------------------------------------------
+// 
+void CUpnpBrowseCommand::CleanupArray(TAny* aDirs)
+    {
+    TFileInfo* dirs = (TFileInfo*) aDirs ;
+    delete[] dirs;
+    }
 
 
 // -----------------------------------------------------------------------------