In perl.git, the branch blead has been updated <http://perl5.git.perl.org/perl.git/commitdiff/9c1314f0ea4d104e361a6e4ededa781e65b14518?hp=17eef65c2fb9a95edf9064575d3413b4ec8219b7>
- Log ----------------------------------------------------------------- commit 9c1314f0ea4d104e361a6e4ededa781e65b14518 Author: Nicholas Clark <[email protected]> Date: Fri Aug 21 22:11:47 2009 +0100 gv_efullname3() could return NULL, so mro::_nextcan() must cope (and croak()). M ext/mro/mro.xs commit 8e234d892cf814aba4e038461a11d692e092aa71 Author: Nicholas Clark <[email protected]> Date: Fri Aug 21 21:50:26 2009 +0100 sv_newmortal() is faster than sv_2mortal(newSV(0)) M ext/mro/mro.xs commit 59d8e2ce29a35e6a471501e81a266a06df49dd05 Author: Nicholas Clark <[email protected]> Date: Fri Aug 21 21:28:18 2009 +0100 Eliminate SV leak in mro::_nextcan - hv_store_ent()'s "key" doesn't take a ref. M ext/mro/mro.xs ----------------------------------------------------------------------- Summary of changes: ext/mro/mro.xs | 17 +++++++++++------ 1 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ext/mro/mro.xs b/ext/mro/mro.xs index 92be620..69557a6 100644 --- a/ext/mro/mro.xs +++ b/ext/mro/mro.xs @@ -533,14 +533,19 @@ mro__nextcan(...) } /* we found a real sub here */ - sv = sv_2mortal(newSV(0)); + sv = sv_newmortal(); gv_efullname3(sv, cvgv, NULL); - fq_subname = SvPVX(sv); - fq_subname_len = SvCUR(sv); + if(SvPOK(sv)) { + fq_subname = SvPVX(sv); + fq_subname_len = SvCUR(sv); + + subname = strrchr(fq_subname, ':'); + } else { + subname = NULL; + } - subname = strrchr(fq_subname, ':'); if(!subname) Perl_croak(aTHX_ "next::method/next::can/maybe::next::method cannot find enclosing method"); @@ -633,14 +638,14 @@ mro__nextcan(...) valid for the child */ if (SvTYPE(candidate) == SVt_PVGV && (cand_cv = GvCV(candidate)) && !GvCVGEN(candidate)) { SvREFCNT_inc_simple_void_NN(MUTABLE_SV(cand_cv)); - (void)hv_store_ent(nmcache, newSVsv(sv), MUTABLE_SV(cand_cv), 0); + (void)hv_store_ent(nmcache, sv, MUTABLE_SV(cand_cv), 0); mXPUSHs(newRV_inc(MUTABLE_SV(cand_cv))); XSRETURN(1); } } } - (void)hv_store_ent(nmcache, newSVsv(sv), &PL_sv_undef, 0); + (void)hv_store_ent(nmcache, sv, &PL_sv_undef, 0); if(throw_nomethod) Perl_croak(aTHX_ "No next::method '%s' found for %s", subname, hvname); XSRETURN_EMPTY; -- Perl5 Master Repository
