Re: Memory Leak due to strdup even after using %destructor

2009-02-04 Thread Hans Aberg
Sorry, it should have been: sequence: { $$ = ...; } | sequence token { $$ = ...; free($2); } That is, as $2 was allocated, it needs to be freed. Hans ___ help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Re: Memory Leak due to strdup even after using %destructor

2009-02-04 Thread Hans Aberg
[Please keep the cc to the Bison list so other know and may help.] Since I use C++, I do not know the details - perhaps somebody else can make it precise. But I figure that one might use actions like sequence: { $$ = ...; } | sequence token { $$ = ...; free($1); }

Re: Memory Leak due to strdup even after using %destructor

2009-02-03 Thread Hans Aberg
On 4 Feb 2009, at 07:40, > wrote: I am new to bison. I got a memory leak. Leak is due to the strdup in lex file astr [-a-zA-Z0-9_\.\/\,\<]* {astr} { yylval.text = strdup( (char *)yytext ); return ASTR; } I have added %des