diff -r 91d5ad76f5c6 -r 16db3449d7ba mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp --- a/mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp Wed Sep 15 12:45:22 2010 +0300 +++ b/mmappcomponents/mmmtpdataprovider/src/mmmtpdputility.cpp Wed Oct 13 15:06:09 2010 +0300 @@ -110,8 +110,14 @@ if ( mime->CompareF( KMimeTypeAudio3gpp ) == 0 || mime->CompareF( KMimeTypeVideo3gpp ) == 0 ) { + delete mime; + mime = NULL; format = EMTPFormatCode3GPContainer; } + } + + if ( mime != NULL ) + { delete mime; mime = NULL; } @@ -519,15 +525,34 @@ HBufC8* MmMtpDpUtility::OdfMimeTypeL( const TDesC& aFullPath ) { PRINT( _L( "MM MTP => MmMtpDpUtility::OdfMimeTypeL" ) ); + HBufC8* mimebuf = NULL; - CContent* content = CContent::NewLC( aFullPath ); // + content - HBufC* buffer = HBufC::NewLC( KMimeTypeMaxLength ); // + buffer + CContent* content = CContent::NewL( aFullPath ); + CleanupStack::PushL( content ); // + content + + HBufC* buffer = HBufC::NewL( KMimeTypeMaxLength ); + CleanupStack::PushL( buffer ); // + buffer TPtr data = buffer->Des(); - User::LeaveIfError( content->GetStringAttribute( EMimeType, data ) ); + TInt err = content->GetStringAttribute( EMimeType, data ); + + if ( err == KErrNone ) + { + mimebuf = HBufC8::New( buffer->Length() ); - HBufC8* mimebuf = HBufC8::NewL( buffer->Length() ); - mimebuf->Des().Copy( *buffer ); + if ( mimebuf == NULL ) + { + User::LeaveIfError( KErrNotFound ); + } + + mimebuf->Des().Copy( *buffer ); + } + + // leave if NULL + if ( mimebuf == NULL ) + { + User::Leave( KErrNotFound ); + } CleanupStack::PopAndDestroy( buffer ); // - buffer CleanupStack::PopAndDestroy( content ); // - content