static void
S_glob_assign_ref(pTHX_ SV *const dstr, SV *const sstr)
{
- SV * const sref = SvREFCNT_inc(SvRV(sstr));
+ SV * const sref = SvRV(sstr);
SV *dref = NULL;
const int intro = GvINTRO(dstr);
SV **location;
GvASSUMECV_on(dstr);
if(GvSTASH(dstr)) mro_method_changed_in(GvSTASH(dstr)); /* sub foo { 1 } sub bar { 2 } *bar = \&foo */
}
- *location = sref;
+ *location = SvREFCNT_inc_simple_NN(sref);
if (import_flag && !(GvFLAGS(dstr) & import_flag)
&& CopSTASH_ne(PL_curcop, GvSTASH(dstr))) {
GvFLAGS(dstr) |= import_flag;
my sub foo{} sub foo:lvalue{}",
'fatal mysub redef warning');
eleak(2, 0, "$all sub foo{} sub foo{}", 'fatal sub redef warning');
-$::TODO = 'still leaks';
eleak(2, 0, "$all *x=sub {}",
'fatal sub redef warning with sub-to-glob assignment');
eleak(2, 0, "$all *x=sub() {1}",
'fatal const sub redef warning with sub-to-glob assignment');
+$::TODO = 'still leaks';
eleak(2, 0, "$all XS::APItest::newCONSTSUB(\\%main::=>name=>0=>1)",
'newXS sub redefinition with fatal warnings');
eleak(2, 0, "$f 'misc'; my\$a,my\$a", 'double my with fatal warnings');