From: Ravi Patil Date: Thu, 20 Jun 2013 12:51:07 +0000 (+0530) Subject: Fixed memory leak in AudioDecoderForm X-Git-Tag: 2.2_release~38 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71341032a4c0fa12607747cac11f1f0cabf06ab6;p=samples%2Fnative%2FMediaApp.git Fixed memory leak in AudioDecoderForm Signed-off-by: Ravi Patil --- diff --git a/project/src/Codec/AudioDecoderForm.cpp b/project/src/Codec/AudioDecoderForm.cpp index c3ddacc..9f8391d 100644 --- a/project/src/Codec/AudioDecoderForm.cpp +++ b/project/src/Codec/AudioDecoderForm.cpp @@ -662,7 +662,7 @@ AudioDecoderForm::StartAudioDecoding(void) result r = E_SUCCESS; String fileName; - unique_ptr pOption; + HashMap option; __totalDecodingTime = 0; Tizen::Media::AudioSampleType sampleType = AUDIO_TYPE_NONE; @@ -703,9 +703,7 @@ AudioDecoderForm::StartAudioDecoding(void) r = __pDstBuf->Construct(dataSize * 2); TryCatch( r == E_SUCCESS, , "Error Occurred:%s %d", GetErrorMessage(r), dataSize*2 ); - pOption.reset(new HashMap()); - TryCatch( pOption.get() != null, r = E_OUT_OF_MEMORY, "Error Occurred:%s", GetErrorMessage(E_OUT_OF_MEMORY)); - r = pOption->Construct(); + r = option.Construct(); TryCatch( r == E_SUCCESS, , "Error Occurred:%s", GetErrorMessage(r)); r = wavReader.GetWavFormatInfo(wavInfo); @@ -713,9 +711,10 @@ AudioDecoderForm::StartAudioDecoding(void) channelType = (wavInfo.nChannels == 1) ? AUDIO_CHANNEL_TYPE_MONO : AUDIO_CHANNEL_TYPE_STEREO; sampleType = AUDIO_TYPE_PCM_S16_LE; - pOption->Add(*(new Integer(MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE)), *(new Integer(channelType))); - pOption->Add(*(new Integer(MEDIA_PROPERTY_AUDIO_SAMPLE_RATE)), *(new Integer(wavInfo.nSamplesPerSec))); - pOption->Add(*(new Integer(MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE)), *(new Integer(sampleType))); + + option.Add(*(new Integer(MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE)), *(new Integer(channelType))); + option.Add(*(new Integer(MEDIA_PROPERTY_AUDIO_SAMPLE_RATE)), *(new Integer(wavInfo.nSamplesPerSec))); + option.Add(*(new Integer(MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE)), *(new Integer(sampleType))); } else { @@ -757,9 +756,11 @@ AudioDecoderForm::StartAudioDecoding(void) __maxBytes = __pSrcBuf->GetRemaining(); - r = __pDec->Construct(__audioCodecId, pOption.get()); + r = __pDec->Construct(__audioCodecId, &option); TryCatch( r == E_SUCCESS, , "Error Occurred" ); + option.RemoveAll(true); + if (__pProgressBar != null) __pProgressBar->SetRange(0, __maxBytes);