diff options
author | Father Chrysostomos <sprout@cpan.org> | 2012-11-12 16:04:07 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2012-11-13 00:01:33 -0800 |
commit | 110af9080c3bd18406d1518c3c9e8cde8aa72e18 (patch) | |
tree | df267397c4bd473c530340dbd878f6129a615145 /pp_ctl.c | |
parent | a36462570c37e1b6544fc8746e99db3d683e2ac1 (diff) | |
download | perl-110af9080c3bd18406d1518c3c9e8cde8aa72e18.tar.gz |
Stop goto &sub from leaking when it croaks
Diffstat (limited to 'pp_ctl.c')
-rw-r--r-- | pp_ctl.c | 7 |
1 files changed, 7 insertions, 0 deletions
@@ -2799,13 +2799,17 @@ PP(pp_goto) FREETMPS; cxix = dopoptosub(cxstack_ix); if (cxix < 0) + { + SvREFCNT_dec(cv); DIE(aTHX_ "Can't goto subroutine outside a subroutine"); + } if (cxix < cxstack_ix) dounwind(cxix); TOPBLOCK(cx); SPAGAIN; /* ban goto in eval: see <20050521150056.GC20213@iabyn.com> */ if (CxTYPE(cx) == CXt_EVAL) { + SvREFCNT_dec(cv); if (CxREALEVAL(cx)) /* diag_listed_as: Can't goto subroutine from an eval-%s */ DIE(aTHX_ "Can't goto subroutine from an eval-string"); @@ -2814,7 +2818,10 @@ PP(pp_goto) DIE(aTHX_ "Can't goto subroutine from an eval-block"); } else if (CxMULTICALL(cx)) + { + SvREFCNT_dec(cv); DIE(aTHX_ "Can't goto subroutine from a sort sub (or similar callback)"); + } if (CxTYPE(cx) == CXt_SUB && CxHASARGS(cx)) { AV* av = cx->blk_sub.argarray; |