diff options
-rw-r--r-- | sv.c | 4 | ||||
-rw-r--r-- | t/op/svleak.t | 2 |
2 files changed, 3 insertions, 3 deletions
@@ -3739,7 +3739,7 @@ S_glob_assign_glob(pTHX_ SV *const dstr, SV *const sstr, const int dtype) 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; @@ -3825,7 +3825,7 @@ S_glob_assign_ref(pTHX_ SV *const dstr, SV *const sstr) 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; diff --git a/t/op/svleak.t b/t/op/svleak.t index e3f6be4e6b..a3c14b80b6 100644 --- a/t/op/svleak.t +++ b/t/op/svleak.t @@ -87,11 +87,11 @@ eleak(2, 0, "no warnings; use feature ':all'; $all 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'); |