Fix memory leaks in ZynAddSubFX

This commit is contained in:
Daniel Winzen
2014-12-19 21:35:43 +01:00
parent ddbb180800
commit b59a50133a
4 changed files with 20 additions and 2 deletions

View File

@@ -102,6 +102,16 @@ LocalZynAddSubFx::~LocalZynAddSubFx()
void LocalZynAddSubFx::initConfig()
{
//Delete existing objects before recreating them in config.init(). Neccesarry, because the constructor and setLmmsWorkingDir() invoke this function.
if( config.cfg.LinuxOSSWaveOutDev != NULL )
{
delete[] config.cfg.LinuxOSSWaveOutDev;
delete[] config.cfg.LinuxOSSSeqInDev;
for(int i = 0; i < config.winmidimax; ++i)
delete[] config.winmididevices[i].name;
delete[] config.winmididevices;
}
config.init();
config.cfg.GzipCompression = 0;

View File

@@ -43,6 +43,14 @@ EQ::EQ(bool insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, in
cleanup();
}
EQ::~EQ()
{
for(int i = 0; i < MAX_EQ_BANDS; ++i) {
delete filter[i].l;
delete filter[i].r;
}
}
// Cleanup the effect
void EQ::cleanup(void)

View File

@@ -30,7 +30,7 @@ class EQ:public Effect
{
public:
EQ(bool insertion_, float *efxoutl_, float *efxoutr_, unsigned int srate, int bufsize);
~EQ() {}
~EQ();
void out(const Stereo<float *> &smp);
void setpreset(unsigned char npreset);
void changepar(int npar, unsigned char value);

View File

@@ -694,7 +694,7 @@ void ADnote::KillNote()
KillVoice(nvoice);
if(NoteVoicePar[nvoice].VoiceOut)
delete NoteVoicePar[nvoice].VoiceOut;
delete[] NoteVoicePar[nvoice].VoiceOut;
NoteVoicePar[nvoice].VoiceOut = NULL;
}