frontend/breakp.c, bug fix, "#306 Deleting breakpoint causes Internal Error in status"

The "delete" command destroyed the whole list of stored breakpoints
  instead of just the specified one.

Thanks to "jpcgt", who reported this in
  "#306 Deleting breakpoint causes Internal Error in status"
  http://sourceforge.net/p/ngspice/bugs/306/
This commit is contained in:
rlar 2015-04-16 19:58:58 +02:00
parent 0b4bcf31f4
commit 8be0829b9b
2 changed files with 17 additions and 12 deletions

View File

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

View File

@ -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 */