Browse Source

Prevent memory leak while "PREDICTOR" is selected

pre-master-46
holger 3 years ago
committed by Holger Vogt
parent
commit
97e0c0f37e
  1. 7
      src/maths/ni/nidest.c
  2. 7
      src/spicelib/analysis/cktdest.c

7
src/maths/ni/nidest.c

@ -16,6 +16,7 @@ Author: 1985 Thomas L. Quarles
void void
NIdestroy(CKTcircuit *ckt) NIdestroy(CKTcircuit *ckt)
{ {
int i;
if (ckt->CKTmatrix) if (ckt->CKTmatrix)
SMPdestroy(ckt->CKTmatrix); SMPdestroy(ckt->CKTmatrix);
ckt->CKTmatrix = NULL; ckt->CKTmatrix = NULL;
@ -33,4 +34,10 @@ NIdestroy(CKTcircuit *ckt)
SENdestroy(ckt->CKTsenInfo); SENdestroy(ckt->CKTsenInfo);
} }
#endif #endif
#ifdef PREDICTOR
if(ckt->CKTpred) FREE(ckt->CKTpred);
for( i=0;i<8;i++) {
if(ckt->CKTsols[i]) FREE(ckt->CKTsols[i]);
}
#endif
} }

7
src/spicelib/analysis/cktdest.c

@ -90,6 +90,13 @@ CKTdestroy(CKTcircuit *ckt)
FREE(ckt->CKTirhsOld); FREE(ckt->CKTirhsOld);
FREE(ckt->CKTirhsSpare); FREE(ckt->CKTirhsSpare);
#ifdef PREDICTOR
if(ckt->CKTpred) FREE(ckt->CKTpred);
for( i=0;i<8;i++) {
if(ckt->CKTsols[i]) FREE(ckt->CKTsols[i]);
}
#endif
FREE(ckt->CKTstat->STATdevNum); FREE(ckt->CKTstat->STATdevNum);
FREE(ckt->CKTstat); FREE(ckt->CKTstat);
FREE(ckt->CKThead); FREE(ckt->CKThead);

Loading…
Cancel
Save