1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-07 20:22:13 +01:00

Fix possible memory leak in use of overrides of BlockFile::CalcSummary

This commit is contained in:
Paul Licameli
2016-04-05 23:30:33 -04:00
parent cea79d5b73
commit 1108c1376c
8 changed files with 34 additions and 32 deletions

View File

@@ -337,14 +337,12 @@ int ODDecodeBlockFile::WriteODDecodeBlockFile()
sampleData.ptr(),
mLen,
mFormat,
NULL);//summaryData);
NULL);
wxASSERT(bSuccess); // TODO: Handle failure here by alert to user and undo partial op.
wxUnusedVar(bSuccess);
mFileNameMutex.Unlock();
// delete [] (char *) summaryData;
mDataAvailableMutex.Lock();
mDataAvailable=true;
@@ -394,9 +392,10 @@ wxFileName ODDecodeBlockFile::GetFileName()
/// @param len The length of the sample data
/// @param format The format of the sample data.
void *ODDecodeBlockFile::CalcSummary(samplePtr buffer, sampleCount len,
sampleFormat format)
sampleFormat format, ArrayOf<char> &cleanup)
{
char* localFullSummary = new char[mSummaryInfo.totalSummaryBytes];
cleanup.reinit(mSummaryInfo.totalSummaryBytes);
char* localFullSummary = cleanup.get();
memcpy(localFullSummary, bheaderTag, bheaderTagLen);