From 0d9d228c114e9c3f61fa9621f6f11bf563adf8b3 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sun, 11 Nov 2018 18:54:24 +0100 Subject: [PATCH] Put the copy for generating permanent next_token exactly at the places where is is needed: INPtermInsert() and fast->conn...->neg_node_str XSPICE memory leaks are gone! --- src/xspice/mif/mif_inp2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/xspice/mif/mif_inp2.c b/src/xspice/mif/mif_inp2.c index f2dc359f5..a6b48e172 100644 --- a/src/xspice/mif/mif_inp2.c +++ b/src/xspice/mif/mif_inp2.c @@ -901,8 +901,6 @@ MIFget_port( return; } - *next_token = copy(*next_token); - /* Get the first connection or the voltage source name */ switch(def_port_type) { @@ -916,6 +914,7 @@ MIFget_port( case MIF_RESISTANCE: case MIF_DIFF_RESISTANCE: + *next_token = copy(*next_token); /* Call the spice3c1 function to put this node in the node list in ckt */ INPtermInsert(ckt, next_token, tab, pos_node); @@ -927,7 +926,7 @@ MIFget_port( break; case MIF_VSOURCE_CURRENT: - + *next_token = copy(*next_token); /* Call the spice3c1 function to put this vsource instance name in */ /* the symbol table */ INPinsert(next_token, tab); @@ -998,6 +997,7 @@ MIFget_port( *status = MIF_ERROR; return; } + *next_token = copy(*next_token); INPtermInsert(ckt, next_token, tab, neg_node); fast->conn[conn_num]->port[port_num]->neg_node_str = *next_token; fast->conn[conn_num]->port[port_num]->smp_data.neg_node = neg_node[0]->number;