add function trnoise_state_free and use it

instead of its individual components
This commit is contained in:
Holger Vogt 2018-08-23 10:12:24 +02:00
parent 7bf81eb122
commit b4c6a7d324
2 changed files with 10 additions and 4 deletions

View File

@ -241,3 +241,12 @@ trrandom_state_init(int rndtype, double TS, double TD, double PARAM1, double PAR
return this;
}
void
trnoise_state_free(struct trnoise_state *this)
{
if (!this)
return;
tfree(this->oneof);
tfree(this);
}

View File

@ -16,10 +16,7 @@ VSRCdelete(GENinstance *gen_inst)
VSRCinstance *inst = (VSRCinstance *) gen_inst;
FREE(inst->VSRCcoeffs);
if (inst->VSRCtrnoise_state) {
FREE(inst->VSRCtrnoise_state->oneof);
FREE(inst->VSRCtrnoise_state);
}
trnoise_state_free(inst->VSRCtrnoise_state);
FREE(inst->VSRCtrrandom_state);
return OK;