1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-25 07:43:54 +02: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

@@ -12,6 +12,7 @@
#ifndef __AUDACITY_BLOCKFILE__
#define __AUDACITY_BLOCKFILE__
#include "MemoryX.h"
#include <wx/string.h>
#include <wx/ffile.h>
#include <wx/filename.h>
@@ -47,8 +48,6 @@ class PROFILE_DLL_API BlockFile /* not final, abstract */ {
BlockFile(wxFileName fileName, sampleCount samples);
virtual ~BlockFile();
static void Deinit();
// Reading
/// Retrieves audio data from this BlockFile
@@ -147,7 +146,9 @@ class PROFILE_DLL_API BlockFile /* not final, abstract */ {
protected:
/// Calculate summary data for the given sample data
virtual void *CalcSummary(samplePtr buffer, sampleCount len,
sampleFormat format);
sampleFormat format,
// This gets filled, if the caller needs to deallocate. Else it is null.
ArrayOf<char> &cleanup);
/// Read the summary section of the file. Derived classes implement.
virtual bool ReadSummary(void *data) = 0;
@@ -159,7 +160,7 @@ class PROFILE_DLL_API BlockFile /* not final, abstract */ {
int mLockCount;
int mRefCount;
static char *fullSummary;
static ArrayOf<char> fullSummary;
protected:
wxFileName mFileName;