diff --git a/src/frontend/inpc_probe.c b/src/frontend/inpc_probe.c index e77437bef..5a7a91f54 100644 --- a/src/frontend/inpc_probe.c +++ b/src/frontend/inpc_probe.c @@ -48,6 +48,7 @@ void inp_probe(struct card* deck) int skip_control = 0; int skip_subckt = 0; wordlist* probes = NULL, *probeparams = NULL, *wltmp, *allsaves = NULL; + wordlist *next_wl = NULL; bool haveall = FALSE, havedifferential = FALSE, t = TRUE, havesave = FALSE; NGHASHPTR instances; /* instance hash table */ int ee = 0; /* serial number for sources */ @@ -140,7 +141,12 @@ void inp_probe(struct card* deck) } } /* don't free the wl_word, they belong to the cards */ - tfree(probes); + wltmp = probes; + while (wltmp) { + next_wl = wltmp->wl_next; + tfree(wltmp); // Do not free the wl_word + wltmp = next_wl; + } /* Set up the hash table for all instances (instance name is key, data is the storage location of the card) */ @@ -188,6 +194,7 @@ void inp_probe(struct card* deck) if (!instname) continue; nghash_insert(instances, instname, card); + tfree(instname); } if (haveall || probeparams == NULL) { @@ -886,6 +893,7 @@ void inp_probe(struct card* deck) tmpcard = nghash_find(instances, instname); if (!tmpcard) { fprintf(stderr, "Warning: Could not find the instance line for %s,\n .probe %s will be ignored\n", instname, wltmp->wl_word); + tfree(instname); continue; } char* thisline = tmpcard->line; @@ -921,6 +929,7 @@ void inp_probe(struct card* deck) else if (err == 3) { fprintf(stderr, "Warning: Number of nodes mismatch,\n .probe %s will be ignored\n", wltmp->wl_word); } + tfree(instname); continue; } else if (!haveall) { @@ -938,6 +947,9 @@ void inp_probe(struct card* deck) } } + if (probeparams) { + wl_free(probeparams); + } nghash_free(instances, NULL, NULL); } diff --git a/src/frontend/inpcom.c b/src/frontend/inpcom.c index 3551975ef..5943c8118 100644 --- a/src/frontend/inpcom.c +++ b/src/frontend/inpcom.c @@ -9944,6 +9944,7 @@ int add_to_sourcepath(const char* filepath, const char* path) scan_new = next; } if (!addwl) { + wl_free(startwl); wl_free(wl); tfree(fpath); return 0; // Not an error. diff --git a/src/frontend/outitf.c b/src/frontend/outitf.c index a59dc6030..b2ef4681e 100644 --- a/src/frontend/outitf.c +++ b/src/frontend/outitf.c @@ -153,11 +153,11 @@ OUTpBeginPlot(CKTcircuit *circuitPtr, JOB *analysisPtr, " is more than the DRAM memory available (%sB)!\n", cmemrequ, n, ctimesteps, cmemavail); fprintf(stderr, " Swapping data to SSD may slow down the simulation.\n"); - tfree(cmemrequ); - tfree(cmemavail); - tfree(ctimesteps); #endif } + tfree(cmemrequ); + tfree(cmemavail); + tfree(ctimesteps); } return ret; diff --git a/src/maths/ni/niiter.c b/src/maths/ni/niiter.c index 85da8ecd7..9f06a62df 100644 --- a/src/maths/ni/niiter.c +++ b/src/maths/ni/niiter.c @@ -278,6 +278,7 @@ NIiter(CKTcircuit *ckt, int maxIter) fprintf(stderr, "too many iterations without convergence: %d iter's (max iter == %d)\n", iterno, maxIter); #endif + FREE(errMsg); } FREE(OldCKTstate0); return(E_ITERLIM);