fix memory leak in PTparse()

This commit is contained in:
rlar 2012-04-05 21:30:41 +02:00
parent 15bda2b9e0
commit 3bb2bd8e05
2 changed files with 4 additions and 4 deletions

View File

@ -1,6 +1,6 @@
%{
/*
* (compile (concat "bison " buffer-file-name))
* (compile (concat "bison " (file-relative-name buffer-file-name)))
*/
#include <stdio.h>
@ -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

View File

@ -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;