diff -r 63223d4fd956 -r 666f9a5a90a9 mmappcomponents/playbackhelper/src/streaminglinkmodel.cpp --- a/mmappcomponents/playbackhelper/src/streaminglinkmodel.cpp Wed Sep 01 12:23:05 2010 +0100 +++ b/mmappcomponents/playbackhelper/src/streaminglinkmodel.cpp Tue Sep 14 22:17:30 2010 +0300 @@ -15,7 +15,7 @@ * */ -// Version : %version: 4 % +// Version : %version: 5 % @@ -559,6 +559,8 @@ TInt size = 0; TInt result = KErrNone; + + TBool linkadded = EFalse; if ( aRamFile.Size( size ) == KErrNone && size <= KMaxLinkFileSize ) { @@ -576,6 +578,8 @@ // Get links from buffer while ( ret == KErrNone ) { + linkadded = EFalse; + // Create a linkitem ptr LinkStruct* linkItem = new( ELeave ) LinkStruct; CleanupStack::PushL( linkItem ); @@ -593,14 +597,23 @@ { ptr2.TrimRight(); iLinkArray.Append( linkItem ); + linkadded = ETrue; } } else { iLinkArray.Append( linkItem ); + linkadded = ETrue; } - CleanupStack::Pop(2); // pop the linkItem and the HbufC created for linkItem->link + if ( linkadded ) + { + CleanupStack::Pop(2); // pop the linkItem and the HbufC created for linkItem->link + } + else + { + CleanupStack::PopAndDestroy(2); //pop and destroy linkItem and the HbufC created for linkItem->link + } } CleanupStack::PopAndDestroy(2); // buffer, recognizer @@ -636,6 +649,8 @@ iLinkCount = 0; TInt ret = KErrNone; + + TBool linkadded = EFalse; if ( aAsxParser ) { @@ -650,6 +665,9 @@ for (TInt i=1; i <= urlCount; i++) { + + linkadded = EFalse; + // Get the asx struct from the parser asxItem = aAsxParser->GetUrl(i); // Set the url to the bufferptr @@ -677,15 +695,23 @@ { ptr2.TrimRight(); iLinkArray.Append( linkItem ); + linkadded = ETrue; } } else { iLinkArray.Append( linkItem ); + linkadded = ETrue; } - - CleanupStack::Pop(2); // pop the linkItem and the HbufC created for linkItem->link - + + if ( linkadded ) + { + CleanupStack::Pop(2); // pop the linkItem and the HbufC created for linkItem->link + } + else + { + CleanupStack::PopAndDestroy(2); //pop and destroy linkItem and the HbufC created for linkItem->link + } } CleanupStack::PopAndDestroy(); //recognizer