Re: [PATCH] Re: Memory corruption? Read-only $_?
Abhijit Menon-Sen [Fri, 13 Jul 2001 07:12:36 +0000 (12:12 +0530)]
Message-ID: <20010713071236.C5669@lustre.dyn.wiw.org>

p4raw-id: //depot/perl@11343

sv.c

diff --git a/sv.c b/sv.c
index d8929df..7a23cc8 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -1570,14 +1570,11 @@ Perl_sv_grow(pTHX_ register SV *sv, register STRLEN newlen)
            Renew(s,newlen,char);
        }
         else {
-           /* If we're growing a newSVpvn_share()d SV, we must unshare
-              the PVX by hand, since sv_force_normal_flags() will try
-              to grow the SV. AMS 20010713 */
+           /* sv_force_normal_flags() must not try to unshare the new
+              PVX we allocate below. AMS 20010713 */
            if (SvREADONLY(sv) && SvFAKE(sv)) {
-               STRLEN len = SvCUR(sv);
                SvFAKE_off(sv);
                SvREADONLY_off(sv);
-               unsharepvn(SvPVX(sv), SvUTF8(sv) ? -(I32)len : len, SvUVX(sv));
            }
            New(703, s, newlen, char);
        }