зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1142757 - Deallocate |inbuf| in the appropriate place to prevent memory leaks and close file streams of |inFile| and |outFile|. r=bwc
--HG-- extra : rebase_source : 117002bd9a156a6e88bad662513919ceba34d85c
This commit is contained in:
Родитель
740177a058
Коммит
907168a1cb
|
@ -301,12 +301,15 @@ void AudioSendAndReceive::GenerateAndReadSamples()
|
|||
FILE* inFile = fopen( iFile.c_str(), "wb+");
|
||||
if(!inFile) {
|
||||
cerr << "Input File Creation Failed " << endl;
|
||||
free(inbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
FILE* outFile = fopen( oFile.c_str(), "wb+");
|
||||
if(!outFile) {
|
||||
cerr << "Output File Creation Failed " << endl;
|
||||
free(inbuf);
|
||||
fclose(inFile);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -323,6 +326,8 @@ void AudioSendAndReceive::GenerateAndReadSamples()
|
|||
{
|
||||
if(!memcpy(audioInput.get(), inbuf, sampleLengthInBytes))
|
||||
{
|
||||
free(inbuf);
|
||||
fclose(outFile);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -350,6 +355,7 @@ void AudioSendAndReceive::GenerateAndReadSamples()
|
|||
}while(numSamplesReadFromInput < SAMPLES);
|
||||
|
||||
FinishWaveHeader(outFile);
|
||||
free(inbuf);
|
||||
fclose(outFile);
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче