/* attach the anon CV to the pad so that
* pad_fixup_inner_anons() can find it */
- if (cv) (void)pad_add_anon(cv, o->op_type);
+ (void)pad_add_anon(cv, o->op_type);
SvREFCNT_inc_simple_void(cv);
}
else {
if (ec) {
op_free(block);
- SvREFCNT_dec(PL_compcv);
+ if (name) SvREFCNT_dec(PL_compcv);
+ else cv = PL_compcv;
PL_compcv = 0;
if (name && block) {
const char *s = strrchr(name, ':');
{
PERL_ARGS_ASSERT_CK_ANONCODE;
- /* After errors, we won’t have any sub. */
- if (!cSVOPo->op_sv) return o;
-
cSVOPo->op_targ = pad_add_anon((CV*)cSVOPo->op_sv, o->op_type);
if (!PL_madskills)
cSVOPo->op_sv = NULL;
use Config;
-plan tests => 66;
+plan tests => 67;
# run some code N times. If the number of SVs at the end of loop N is
# greater than (N-1)*delta at the end of loop 1, we've got a leak
eleak(2, 0, '+sub:a{}', 'anon subs with invalid attributes');
eleak(2, 0, 'no warnings; sub a{1 1}', 'sub with syntax error');
+eleak(2, 0, 'no warnings; sub {1 1}', 'anon sub with syntax error');
# Syntax errors
eleak(2, 0, '"${<<END}"