For unsetup de-allocate the memory

that has been allocated locally in the code model during INIT
This commit is contained in:
Holger Vogt 2018-08-28 17:11:51 +02:00
parent 7d12b4897c
commit 2867678f99
1 changed files with 16 additions and 0 deletions

View File

@ -532,6 +532,22 @@ MIFunsetup(GENmodel *inModel,CKTcircuit *ckt)
tfree(here->state);
tfree(here->conv);
tfree(here->intgr);
/* de-allocate the memory that has been allocated locally in the code model during INIT */
if (here->callback) {
Mif_Private_t cm_data;
/* Prepare the structure to be passed to the code model */
cm_data.num_conn = here->num_conn;
cm_data.conn = here->conn;
cm_data.num_param = here->num_param;
cm_data.param = here->param;
cm_data.num_inst_var = here->num_inst_var;
cm_data.inst_var = here->inst_var;
cm_data.callback = &(here->callback);
here->callback(&cm_data, MIF_CB_DESTROY);
}
here->initialized = MIF_FALSE;
} /* end for all instances */
}