Remove a memory leak

Make inp_rem_levels non-static
and use it to remove 'root' after it has been used.
This commit is contained in:
Holger Vogt 2021-07-05 19:42:14 +02:00
parent 54cbfb4138
commit 0f25c25c7e
2 changed files with 4 additions and 2 deletions

View File

@ -78,6 +78,7 @@ extern bool ft_batchmode;
/* from inpcom.c */
extern struct nscope* inp_add_levels(struct card *deck);
extern void inp_rem_levels(struct nscope* root);
extern void comment_out_unused_subckt_models(struct card *deck);
extern void inp_rem_unused_models(struct nscope *root, struct card *deck);
@ -2409,6 +2410,7 @@ static void rem_unused_mos_models(struct card* deck) {
struct nscope* root = inp_add_levels(deck);
comment_out_unused_subckt_models(deck);
inp_rem_unused_models(root, deck);
inp_rem_levels(root);
/* remove unused binning models */
for (tmpc = deck; tmpc; tmppc = tmpc, tmpc = tmpc->nextcard) {
char* curr_line;

View File

@ -169,7 +169,7 @@ static char *search_plain_identifier(char *str, const char *identifier);
struct nscope *inp_add_levels(struct card *deck);
static struct card_assoc *find_subckt(struct nscope *scope, const char *name);
static void inp_rem_levels(struct nscope *root);
void inp_rem_levels(struct nscope *root);
void inp_rem_unused_models(struct nscope *root, struct card *deck);
static struct modellist *inp_find_model(
struct nscope *scope, const char *name);
@ -9388,7 +9388,7 @@ struct nscope *inp_add_levels(struct card *deck)
}
/* remove the level and subckts entries */
static void inp_rem_levels(struct nscope *root)
void inp_rem_levels(struct nscope *root)
{
struct card_assoc *p = root->subckts;
while (p) {