add a callback to de-allocate the static variable p->element
This commit is contained in:
parent
06df6ca8e7
commit
c4f8a02eb0
|
|
@ -68,6 +68,20 @@ and function nxtpwr() performs the function of subroutine NXTPWR.
|
|||
static double evterm(double x, int n);
|
||||
static void nxtpwr(int *pwrseq, int pdim);
|
||||
|
||||
static void
|
||||
cm_spice2poly_callback(ARGS, Mif_Callback_Reason_t reason)
|
||||
{
|
||||
switch (reason) {
|
||||
case MIF_CB_DESTROY: {
|
||||
Mif_Inst_Var_Data_t *p = STATIC_VAR_INST(acgains);
|
||||
if(p->element) {
|
||||
free(p->element);
|
||||
p->element = NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
@ -98,6 +112,7 @@ void spice2poly (ARGS)
|
|||
/* array */
|
||||
|
||||
if(INIT) {
|
||||
CALLBACK = cm_spice2poly_callback;
|
||||
Mif_Inst_Var_Data_t *p = STATIC_VAR_INST(acgains);
|
||||
p -> size = num_inputs;
|
||||
p -> element = (Mif_Value_t *) malloc((size_t) num_inputs * sizeof(Mif_Value_t));
|
||||
|
|
|
|||
Loading…
Reference in New Issue