Skip to content

Conversation

mike-lischke
Copy link
Member

A different approach to the problem, now really fixing the leak.

@chrisaycock
Copy link
Contributor

I hate to reopen this debate, but @chund is right; that is definitely a double free. In C++, throw copies the exception object and then invokes the destructor. So the catch object (in the generated parse() function from ...Parser.cpp) now contains a copy of the pointer that has just been freed. So once catch ends, the destructor is run a second time on that pointer.

The solution is to simply switch to a shared_ptr. This PR almost has it; there shouldn't be a destructor at all for NoViableAltException if _deadEndConfigs is a shared_ptr.

@mike-lischke
Copy link
Member Author

@chund @chrisaycock since this PR is already closed let's discuss this issue in the reference bug report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants