summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-11-12 16:04:07 -0800
committerFather Chrysostomos <sprout@cpan.org>2012-11-13 00:01:33 -0800
commit110af9080c3bd18406d1518c3c9e8cde8aa72e18 (patch)
treedf267397c4bd473c530340dbd878f6129a615145 /pp_ctl.c
parenta36462570c37e1b6544fc8746e99db3d683e2ac1 (diff)
downloadperl-110af9080c3bd18406d1518c3c9e8cde8aa72e18.tar.gz
Stop goto &sub from leaking when it croaks
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 22e1cea57f..0df8b0c132 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -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;