Plug a memory leak in transmission line cpl
This commit is contained in:
parent
bb47e95f7f
commit
54458ba172
|
|
@ -11,3 +11,4 @@ extern int CPLmParam(int,IFvalue*, GENmodel*);
|
||||||
extern int CPLparam(int,IFvalue*, GENinstance*, IFvalue*);
|
extern int CPLparam(int,IFvalue*, GENinstance*, IFvalue*);
|
||||||
extern int CPLsetup(SMPmatrix*, GENmodel*, CKTcircuit*, int*);
|
extern int CPLsetup(SMPmatrix*, GENmodel*, CKTcircuit*, int*);
|
||||||
extern int CPLunsetup(GENmodel*, CKTcircuit*);
|
extern int CPLunsetup(GENmodel*, CKTcircuit*);
|
||||||
|
extern int CPLdevDelete(GENinstance*);
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ SPICEdev CPLinfo = {
|
||||||
.DEVaccept = NULL,
|
.DEVaccept = NULL,
|
||||||
.DEVdestroy = NULL,
|
.DEVdestroy = NULL,
|
||||||
.DEVmodDelete = NULL,
|
.DEVmodDelete = NULL,
|
||||||
.DEVdelete = NULL,
|
.DEVdelete = CPLdevDelete,
|
||||||
.DEVsetic = NULL,
|
.DEVsetic = NULL,
|
||||||
.DEVask = CPLask,
|
.DEVask = CPLask,
|
||||||
.DEVmodAsk = CPLmAsk,
|
.DEVmodAsk = CPLmAsk,
|
||||||
|
|
|
||||||
|
|
@ -2146,3 +2146,21 @@ static int rotate(int dim_in, int p, int q)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
CPLdevDelete(GENinstance* inst)
|
||||||
|
{
|
||||||
|
VI_list* tmplist, * prevlist;
|
||||||
|
CPLinstance* here = (CPLinstance*)inst;
|
||||||
|
if (here->cplines2)
|
||||||
|
tfree(here->cplines2);
|
||||||
|
if (here->cplines) {
|
||||||
|
prevlist = tmplist = here->cplines->vi_head;
|
||||||
|
while (tmplist) {
|
||||||
|
tmplist = tmplist->next;
|
||||||
|
tfree(prevlist);
|
||||||
|
prevlist = tmplist;
|
||||||
|
}
|
||||||
|
tfree(here->cplines);
|
||||||
|
}
|
||||||
|
return OK;
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue