Fix memory leaks for paranoia_parallel.

Tests with leaks:
  examples/various/probe-i-dev.cir
  examples/vdmos/100W.sp
  multiple tests using OUTpBeginPlot, add_to_sourcepath
This commit is contained in:
Brian Taylor 2026-05-16 13:22:48 -07:00
parent e030e96c20
commit cf825fd80a
4 changed files with 10 additions and 8 deletions

View File

@ -142,7 +142,7 @@ void inp_probe(struct card* deck)
}
/* don't free the wl_word, they belong to the cards */
wltmp = probes;
while (wltmp) {
while (wltmp) { // Fix memory leak probe-i-dev.cir
next_wl = wltmp->wl_next;
tfree(wltmp); // Do not free the wl_word
wltmp = next_wl;
@ -194,7 +194,7 @@ void inp_probe(struct card* deck)
if (!instname)
continue;
nghash_insert(instances, instname, card);
tfree(instname);
tfree(instname); // Fix memory leak probe-i-dev.cir
}
if (haveall || probeparams == NULL) {
@ -893,7 +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);
tfree(instname); // Fix memory leak probe-i-dev.cir
continue;
}
char* thisline = tmpcard->line;
@ -929,7 +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);
tfree(instname); // Fix memory leak probe-i-dev.cir
continue;
}
else if (!haveall) {
@ -948,7 +948,7 @@ void inp_probe(struct card* deck)
}
if (probeparams) {
wl_free(probeparams);
wl_free(probeparams); // Fix memory leak probe-i-dev.cir
}
nghash_free(instances, NULL, NULL);
}

View File

@ -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.

View File

@ -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;

View File

@ -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);