plug a memory leak by CALLBACK,
deleting locally malloced memory
This commit is contained in:
parent
e89a92f944
commit
29b2799c22
|
|
@ -224,6 +224,25 @@ NON-STANDARD FEATURES
|
||||||
|
|
||||||
==============================================================================*/
|
==============================================================================*/
|
||||||
|
|
||||||
|
static void
|
||||||
|
cm_pwl_callback(ARGS, Mif_Callback_Reason_t reason)
|
||||||
|
{
|
||||||
|
switch (reason) {
|
||||||
|
case MIF_CB_DESTROY: {
|
||||||
|
double *last_x_value = STATIC_VAR (last_x_value);
|
||||||
|
double *x = STATIC_VAR (x);
|
||||||
|
double *y = STATIC_VAR (y);
|
||||||
|
free(last_x_value);
|
||||||
|
free(x);
|
||||||
|
free(y);
|
||||||
|
STATIC_VAR (last_x_value) = NULL;
|
||||||
|
STATIC_VAR (x) = NULL;
|
||||||
|
STATIC_VAR (y) = NULL;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*=== CM_PWL ROUTINE ================*/
|
/*=== CM_PWL ROUTINE ================*/
|
||||||
|
|
||||||
void cm_pwl(ARGS) /* structure holding parms,
|
void cm_pwl(ARGS) /* structure holding parms,
|
||||||
|
|
@ -251,6 +270,8 @@ void cm_pwl(ARGS) /* structure holding parms,
|
||||||
|
|
||||||
Mif_Complex_t ac_gain;
|
Mif_Complex_t ac_gain;
|
||||||
|
|
||||||
|
CALLBACK = cm_pwl_callback;
|
||||||
|
|
||||||
char *allocation_error="\n***ERROR***\nPWL: Allocation calloc failed!\n";
|
char *allocation_error="\n***ERROR***\nPWL: Allocation calloc failed!\n";
|
||||||
char *limit_error="\n***ERROR***\nPWL: Violation of 50% rule in breakpoints!\n";
|
char *limit_error="\n***ERROR***\nPWL: Violation of 50% rule in breakpoints!\n";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue