emailservices/emailclientapi/src/emailmessage.cpp
branchRCL_3
changeset 16 b5fbb9b25d57
parent 13 8592a65ad3fb
child 24 d189ee25cf9d
--- a/emailservices/emailclientapi/src/emailmessage.cpp	Tue Apr 27 16:20:14 2010 +0300
+++ b/emailservices/emailclientapi/src/emailmessage.cpp	Tue May 11 15:57:15 2010 +0300
@@ -505,12 +505,12 @@
 
     RPointerArray<CFSMailMessagePart> parts;
     CleanupResetAndDestroyPushL( parts );
-    iPluginMessage->ChildPartsL(parts);
+    iPluginMessage->ChildPartsL( parts );
     TInt count( parts.Count() );
     if( count == 0 )
         {
         /* No content, return NULL */
-        CleanupStack::Pop(); // parts
+        CleanupStack::PopAndDestroy( &parts ); // in case heap allocated but not used
         return NULL;
         }
     CFSMailMessagePart* part = parts[0];
@@ -524,7 +524,8 @@
     if ( contentType.Equals( KFSMailContentTypeTextPlain ) || 
         contentType.Equals( KFSMailContentTypeTextHtml ) )
         {                                
-        iTextContent = CEmailTextContent::NewL(iPluginData, msgContentId, part, EAPIOwns );        
+        iTextContent = CEmailTextContent::NewL(iPluginData, msgContentId, part, EAPIOwns );
+        parts[0] = NULL; // ownership of part transferred
         }
     else if ( contentType.Equals( KFSMailContentTypeMultipartMixed ) ||
               contentType.Equals( KFSMailContentTypeMultipartAlternative ) ||
@@ -533,13 +534,10 @@
               contentType.Equals( KFSMailContentTypeMultipartParallel ) )
         {
         iContent = CEmailMultipart::NewL(iPluginData, msgContentId, part, EAPIOwns);
+        parts[0] = NULL; // ownership of part transferred
         }
-    if ( count == 2 )
-        {
-        CFSMailMessagePart* part = parts[1];
-        const TDesC& contentType = part->GetContentType();
-        }
-    CleanupStack::Pop(); // parts
+
+    CleanupStack::PopAndDestroy( &parts ); // parts
     
     if (iTextContent)
         {