diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-15 04:54:17 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-15 04:54:17 +0000 |
commit | 850fabdf2ccd0a80b987899ff0014695459be38a (patch) | |
tree | 6f9adcc4c71d8a3dc9bebf4299fde8ed5ffeb52e /sv.c | |
parent | d4777f279225b24fa563b5d349bba036eebe5439 (diff) | |
download | perl-850fabdf2ccd0a80b987899ff0014695459be38a.tar.gz |
fix memory leak in C<$x = *Y> provoked by change#4198, which
introduced XPVMG storage in arenas
p4raw-link: @4198 on //depot/perl: 932e9ff92dfdad82564fe7085f2cb398e628fac3
p4raw-id: //depot/perl@5090
Diffstat (limited to 'sv.c')
-rw-r--r-- | sv.c | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -5224,6 +5224,8 @@ Perl_sv_bless(pTHX_ SV *sv, HV *stash) STATIC void S_sv_unglob(pTHX_ SV *sv) { + void *xpvmg; + assert(SvTYPE(sv) == SVt_PVGV); SvFAKE_off(sv); if (GvGP(sv)) @@ -5235,6 +5237,13 @@ S_sv_unglob(pTHX_ SV *sv) sv_unmagic(sv, '*'); Safefree(GvNAME(sv)); GvMULTI_off(sv); + + /* need to keep SvANY(sv) in the right arena */ + xpvmg = new_XPVMG(); + StructCopy(SvANY(sv), xpvmg, XPVMG); + del_XPVGV(SvANY(sv)); + SvANY(sv) = xpvmg; + SvFLAGS(sv) &= ~SVTYPEMASK; SvFLAGS(sv) |= SVt_PVMG; } |