diff --git a/src/frontend/numparam/numparam.h b/src/frontend/numparam/numparam.h index 71c1df6c2..442a528e9 100644 --- a/src/frontend/numparam/numparam.h +++ b/src/frontend/numparam/numparam.h @@ -77,3 +77,4 @@ void nupa_subcktexit(tdico *dico); tdico *nupa_fetchinstance(void); char getidtype(tdico *d, char *s); entry *attrib(tdico *d, NGHASHPTR htable, char *t, char op); +void del_attrib(entry *); diff --git a/src/frontend/numparam/spicenum.c b/src/frontend/numparam/spicenum.c index 88f88ecb5..134b3be41 100644 --- a/src/frontend/numparam/spicenum.c +++ b/src/frontend/numparam/spicenum.c @@ -489,7 +489,7 @@ nupa_del_dicoS(void) dispose(dicoS->dyncategory); dispose(dicoS->inst_name); dispose(dicoS->local_symbols); - nghash_free(dicoS->global_symbols, NULL, NULL); + nghash_free(dicoS->global_symbols, del_attrib, NULL); dispose(dicoS); dicoS = NULL; } diff --git a/src/frontend/numparam/xpressn.c b/src/frontend/numparam/xpressn.c index e4d12e742..842658d88 100644 --- a/src/frontend/numparam/xpressn.c +++ b/src/frontend/numparam/xpressn.c @@ -439,6 +439,21 @@ attrib(tdico *dico_p, NGHASHPTR htable_p, char *t, char op) } +/* user defined delete function: + * free the dictionary entries malloc'ed above + * will be called by nghash_free() in nupa_del_dicoS() + */ + +void +del_attrib(entry *entry_p) +{ + if(entry_p) { + tfree(entry_p->symbol); + tfree(entry_p); + } +} + + static bool define(tdico *dico, char *t, /* identifier to define */