diff options
author | Dave Mitchell <davem@fdisolutions.com> | 2006-05-27 00:31:33 +0000 |
---|---|---|
committer | Dave Mitchell <davem@fdisolutions.com> | 2006-05-27 00:31:33 +0000 |
commit | 0539ab63267d5a989c8b513c410c39b33c15aa25 (patch) | |
tree | 4b261a2116ec9b899d95950017ddde2b4964f1d7 /perly.c | |
parent | a8ff2fa6faa01a256e2aff8c5e61378859eb3d62 (diff) | |
download | perl-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.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -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--; |