Browse Source

plug a memory leak (pll-xspice.cir)

pre-master-46
Holger Vogt 6 years ago
parent
commit
2f23c58585
  1. 4
      src/frontend/runcoms2.c
  2. 1
      src/include/ngspice/evtproto.h
  3. 23
      src/xspice/evt/evtsetup.c

4
src/frontend/runcoms2.c

@ -26,6 +26,7 @@ Author: 1985 Wayne A. Christopher, U. C. Berkeley CAD Group
#include "numparam/numpaif.h"
#include "ngspice/inpdefs.h"
#include "ngspice/evtproto.h"
extern void line_free_x(struct card *deck, bool recurse);
extern INPmodel *modtab;
@ -237,6 +238,9 @@ com_remcirc(wordlist *wl)
/* The next lines stem from com_rset */
INPkillMods();
/* remove event queues */
EVTunsetup(ft_curckt->ci_ckt);
if_cktfree(ft_curckt->ci_ckt, ft_curckt->ci_symtab);
for (v = ft_curckt->ci_vars; v; v = next) {
next = v->va_next;

1
src/include/ngspice/evtproto.h

@ -65,6 +65,7 @@ void EVTtermInsert(
char **err_msg);
int EVTsetup(CKTcircuit *ckt);
int EVTunsetup(CKTcircuit* ckt);
int EVTdest(Evt_Ckt_Data_t *evt);

23
src/xspice/evt/evtsetup.c

@ -135,6 +135,29 @@ int EVTsetup(
}
int EVTunsetup(
CKTcircuit* ckt) /* The circuit structure */
{
int err;
/* Exit immediately if no event-driven instances in circuit */
if (ckt->evt->counts.num_insts == 0)
return(OK);
/* Clear the inst, node, and output queues, and initialize the to_call */
/* elements in the instance queue to call all event-driven instances */
err = EVTsetup_queues(ckt);
if (err)
return(err);
/* Initialize additional event data */
g_mif_info.circuit.evt_step = 0.0;
/* Return OK */
return(OK);
}
/*

Loading…
Cancel
Save