Hello,

But I get a memory leak even when I free the the in the bison file like this: WORD EQUAL WORD { $$ = !strncmp( $1, $3, 128 ); free( yylval.str ); }

have found out how to avoid the memory leak myself and thought I would post it 
here
in case somebody runs into the same issue.

One has to free the variables like this:

WORD EQUAL WORD { $$ = !strcmp( $1, $3 ); free($1); free($3); }



regards,
arno




I do not get an error message when compiling but valgrind shows me a leak in the strdup() function:

 > valgrind --leak-check=full rules
...
...
==935== 3 bytes in 1 blocks are definitely lost in loss record 2 of 3
==935==    at 0x401B46D: malloc (vg_replace_malloc.c:149)
==935==    by 0x40D1B9F: strdup (in /lib/tls/libc-2.3.6.so)
==935==    by 0x8048976: yylex (in /RulezParser/flex_bison_test/rules)
==935==    by 0x804990E: yyparse (in /RulezParser/flex_bison_test/rules)
==935==    by 0x804A498: main (in /RulezParser/flex_bison_test/rules)
...

Guess I search the archives and consult the manual before I post a question about this issue -
except somebody here on this list can give me a hint ;-)



thanks,
arno


_______________________________________________
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison




_______________________________________________
Help-bison@gnu.org http://lists.gnu.org/mailman/listinfo/help-bison

Reply via email to