diff --git a/src/frontend/breakp.c b/src/frontend/breakp.c index fd9b6e7b6..d9c6b49af 100644 --- a/src/frontend/breakp.c +++ b/src/frontend/breakp.c @@ -296,6 +296,19 @@ com_sttus(wordlist *wl) * function settrace() in breakp2.c */ +void +dbfree1(struct dbcomm *dd) +{ + tfree(dd->db_nodename1); + tfree(dd->db_nodename2); + if (dd->db_also) { + dbfree(dd->db_also); + dd->db_also = NULL; + } + tfree(dd); +} + + void dbfree(struct dbcomm *db) { @@ -303,13 +316,7 @@ dbfree(struct dbcomm *db) for (dd = db; dd; dd = dn) { dn = dd->db_next; - tfree(dd->db_nodename1); - tfree(dd->db_nodename2); - if (dd->db_also) { - dbfree(dd->db_also); - dd->db_also = NULL; - } - tfree(dd); + dbfree1(dd); } } @@ -324,10 +331,7 @@ com_delete(wordlist *wl) struct dbcomm *d, *dt; if (wl && eq(wl->wl_word, "all")) { - for (dt = dbs; dt; dt = d) { - d = dt->db_next; - dbfree(dt); - } + dbfree(dbs); ft_curckt->ci_dbs = dbs = NULL; return; } else if (!wl) { @@ -362,7 +366,7 @@ com_delete(wordlist *wl) dt->db_next = d->db_next; else ft_curckt->ci_dbs = dbs = d->db_next; - dbfree(d); + dbfree1(d); (void) sprintf(buf, "%d", i); cp_remkword(CT_DBNUMS, buf); break; diff --git a/src/include/ngspice/fteext.h b/src/include/ngspice/fteext.h index f936b5ace..85fc2bd18 100644 --- a/src/include/ngspice/fteext.h +++ b/src/include/ngspice/fteext.h @@ -30,6 +30,7 @@ extern void ft_checkkids(void); extern bool ft_bpcheck(struct plot *runplot, int iteration); extern void dbfree(struct dbcomm *db); +extern void dbfree1(struct dbcomm *db); /* breakp2.c */