Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for antlr#2164. #2398

Merged
merged 1 commit into from
Nov 11, 2018
Merged

Fix for antlr#2164. #2398

merged 1 commit into from
Nov 11, 2018

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