BNFC / bnfc

BNF Converter
http://bnfc.digitalgrammars.com/
583 stars 161 forks source link

C and C++ parsers leak memory on syntax errors #240

Open justinmeiners opened 5 years ago

justinmeiners commented 5 years ago

Currently, C and C++ parsers leak the entire syntax tree whenever a syntax error is encountered.

Bison provides a mechanism for handling destruction when syntax fails to parse Destructors. However, it is not trivial to implement.

capi1500 commented 10 months ago

C++ parser also leaks memory on successful parse. If I understand correctly, some buffer isn't freed after parsing in C++ parser.

C parser leaks memory only on failed parse.