leaks memory. It's not quite clear to me what happens here. Apparently, yaep_free_grammar() deallocates some substructures of struct grammar, but not the memory for struct grammar itself (the first two lines of main() are sufficient to expose this problem). But in addition, yaep_create_grammar() and yaep_free_grammar() seem to handle a global grammar object (which kind of defeats the purpose of having multiple grammars) and thus some memory becomes lost permanently.
Pull request #11 fixes the memory leak. The handling of a global object is a different problem. I'll open a separate issue for that. This issue can then be closed once the pull request is merged.
The following very simple program:
leaks memory. It's not quite clear to me what happens here. Apparently,
yaep_free_grammar()
deallocates some substructures ofstruct grammar
, but not the memory forstruct grammar
itself (the first two lines ofmain()
are sufficient to expose this problem). But in addition,yaep_create_grammar()
andyaep_free_grammar()
seem to handle a globalgrammar
object (which kind of defeats the purpose of having multiple grammars) and thus some memory becomes lost permanently.