mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-11 05:13:04 +00:00
Fix push parsing memory leak reported by Brandon Lucia at
<http://lists.gnu.org/archive/html/bug-bison/2007-07/msg00032.html>. * THANKS: Add Brandon Lucia. * data/push.c (yypstate_delete): Free the stack if it was reallocated but the parse never completed and thus freed it. * tests/Makefile.am (TESTSUITE_AT): Add push.at. * tests/testsuite.at: Include push.at. * test/push.at: New. (Push Parsing: Memory Leak for Early Deletion): New test case.
This commit is contained in:
@@ -1124,6 +1124,12 @@ b4_push_if(
|
||||
]b4_c_function_def([[yypstate_delete]], [[void]],
|
||||
[[[yypstate *yyps]], [[yyps]]])[
|
||||
{
|
||||
#ifndef yyoverflow
|
||||
/* If the stack was reallocated but the parse did not complete, then the
|
||||
stack still needs to be freed. */
|
||||
if (!yyps->yynew && yyps->yyss != yyps->yyssa)
|
||||
YYSTACK_FREE (yyps->yyss);
|
||||
#endif
|
||||
free (yyps);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user