harvester/server/src/reharvesterao.cpp
changeset 40 910a23996aa0
parent 23 33ae025ac1e8
child 43 c5e73110f733
--- a/harvester/server/src/reharvesterao.cpp	Wed Jul 14 07:57:22 2010 +0300
+++ b/harvester/server/src/reharvesterao.cpp	Fri Jul 23 10:03:59 2010 +0300
@@ -165,6 +165,7 @@
             WRITELOG1("CReHarvesterAO::AddItem() - %S already exists in re-harvester queue", &aItem->Uri() );
 #endif
             delete aItem;
+            aItem = NULL;
             return;
             }
         }
@@ -173,11 +174,16 @@
     if( mdeObject )
     	{
     	delete mdeObject;
+    	mdeObject = NULL;
     	aItem->SetMdeObject( NULL );
     	}
     
-    iItems.Append( aItem );
-    
+    if(iItems.Append( aItem ) != KErrNone )
+        {
+        delete aItem;
+        aItem = NULL;
+        }
+
     iDelay = KResumeTime;
     const TTimeIntervalMicroSeconds32 delay = TTimeIntervalMicroSeconds32( iDelay );
     
@@ -206,6 +212,7 @@
         // found matching item
 	    iItems.Remove( i );
 	    delete item;
+	    item = NULL;
         }
     
     if ( iItems.Count() == 0 )