plug a memory leak (pll-xspice.cir)

This commit is contained in:
Holger Vogt 2020-02-28 18:11:58 +01:00
parent 14c0828a65
commit 2f23c58585
3 changed files with 28 additions and 0 deletions

View File

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

View File

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

View File

@ -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);
}
/*