diff --git a/src/spicelib/parser/inpptree-parser.y b/src/spicelib/parser/inpptree-parser.y index 626598537..c83c95e66 100644 --- a/src/spicelib/parser/inpptree-parser.y +++ b/src/spicelib/parser/inpptree-parser.y @@ -1,6 +1,6 @@ %{ /* - * (compile (concat "bison " buffer-file-name)) + * (compile (concat "bison " (file-relative-name buffer-file-name))) */ #include @@ -94,7 +94,7 @@ expression: exp exp: TOK_NUM { $$ = mknnode($1); } - | TOK_STR { $$ = mksnode($1, ckt); } + | TOK_STR { $$ = mksnode($1, ckt); txfree((void*)$1); } | exp '+' exp { $$ = mkbnode("+", $1, $3); } | exp '-' exp { $$ = mkbnode("-", $1, $3); } @@ -106,7 +106,7 @@ exp: | '-' exp %prec NEG { $$ = mkfnode("-",$2); } - | TOK_STR '(' nonempty_arglist ')' { $$ = mkfnode($1, $3); } + | TOK_STR '(' nonempty_arglist ')' { $$ = mkfnode($1, $3); txfree((void*)$1); } | TOK_pnode diff --git a/src/spicelib/parser/inpptree.c b/src/spicelib/parser/inpptree.c index 9c57f3d43..7e3686f8e 100644 --- a/src/spicelib/parser/inpptree.c +++ b/src/spicelib/parser/inpptree.c @@ -1021,7 +1021,7 @@ static INPparseNode *mksnode(const char *string, void *ckt) if (i == NUM_CONSTANTS) { /* We'd better save this in case it's part of i(something). */ p->type = PT_PLACEHOLDER; - p->funcname = (/*nonconst*/ char *) string; + p->funcname = copy(string); } else { p->type = PT_CONSTANT; p->constant = constants[i].value;