From 7d44aa9564ac9795c318996fdcbac0faf2209473 Mon Sep 17 00:00:00 2001 From: rlar Date: Fri, 18 Jul 2014 18:08:27 +0200 Subject: [PATCH] subckt.c, doit(), fix an ancient memory leak when use_numparams == FALSE --- src/frontend/subckt.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/frontend/subckt.c b/src/frontend/subckt.c index 19b119985..658c62dda 100644 --- a/src/frontend/subckt.c +++ b/src/frontend/subckt.c @@ -618,15 +618,14 @@ doit(struct line *deck, wordlist *modnames) { { struct line *rest_of_c = c->li_next; if (use_numparams == FALSE) { - /* old style: c will drop a dangling pointer: memory leak */ + line_free_x(c, FALSE); /* drop the invocation */ if (prev_of_c) prev_of_c->li_next = su_deck; else deck = su_deck; } else { - /* ifdef NUMPARAMS, keep the invoke line as a comment */ + c->li_line[0] = '*'; /* comment the invocation */ c->li_next = su_deck; - c->li_line[0] = '*'; /* comment it out */ } c = su_deck; while (c->li_next)