summaryrefslogtreecommitdiff
path: root/perly.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2006-05-27 00:31:33 +0000
committerDave Mitchell <davem@fdisolutions.com>2006-05-27 00:31:33 +0000
commit0539ab63267d5a989c8b513c410c39b33c15aa25 (patch)
tree4b261a2116ec9b899d95950017ddde2b4964f1d7 /perly.c
parenta8ff2fa6faa01a256e2aff8c5e61378859eb3d62 (diff)
downloadperl-0539ab63267d5a989c8b513c410c39b33c15aa25.tar.gz
stop OPs leaking in eval "syntax error"
When bison pops states during error recovery, any states holding an OP would leak the OP. Create an extra YY table that tells us which states are of type opval, and when popping one of those, free the op. p4raw-id: //depot/perl@28315
Diffstat (limited to 'perly.c')
-rw-r--r--perly.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/perly.c b/perly.c
index 18f8606bff..adf36063f1 100644
--- a/perly.c
+++ b/perly.c
@@ -613,6 +613,10 @@ Perl_yyparse (pTHX)
/* Pop the rest of the stack. */
while (yyss < yyssp) {
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp);
+ if (yy_is_opval[yystos[*yyssp]]) {
+ YYDPRINTF ((Perl_debug_log, "(freeing op)\n"));
+ op_free(yyvsp->opval);
+ }
YYPOPSTACK;
}
YYABORT;
@@ -650,6 +654,10 @@ Perl_yyparse (pTHX)
YYABORT;
YYDSYMPRINTF ("Error: popping", yystos[*yyssp], yyvsp);
+ if (yy_is_opval[yystos[*yyssp]]) {
+ YYDPRINTF ((Perl_debug_log, "(freeing op)\n"));
+ op_free(yyvsp->opval);
+ }
yyvsp--;
#ifdef DEBUGGING
yynsp--;