This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
remove leaks associated with version object change #23190
authorDave Mitchell <davem@fdisolutions.com>
Fri, 6 Aug 2004 10:06:46 +0000 (10:06 +0000)
committerDave Mitchell <davem@fdisolutions.com>
Fri, 6 Aug 2004 10:06:46 +0000 (10:06 +0000)
p4raw-link: @23190 on //depot/perl: d7aa53827cc12fdf8a697328df844e16aaa58287

p4raw-id: //depot/perl@23198

gv.c
util.c

diff --git a/gv.c b/gv.c
index d9d16ed..7474e81 100644 (file)
--- a/gv.c
+++ b/gv.c
@@ -1071,9 +1071,9 @@ Perl_gv_fetchpv(pTHX_ const char *nambeg, I32 add, I32 sv_type)
     case '\026':       /* $^V */
        if (len == 1) {
            SV *sv = GvSV(gv);
-           sv = new_version(PL_patchlevel);
-           SvREADONLY_on(sv);
-           GvSV(gv) = sv;
+           GvSV(gv) = new_version(PL_patchlevel);
+           SvREADONLY_on(GvSV(gv));
+           SvREFCNT_dec(sv);
        }
        break;
     }
diff --git a/util.c b/util.c
index 8d4c13e..cd28c19 100644 (file)
--- a/util.c
+++ b/util.c
@@ -3887,6 +3887,7 @@ Perl_scan_version(pTHX_ char *s, SV *rv, bool qv)
     bool saw_under = 0;
     SV* sv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */
     (void)sv_upgrade(sv, SVt_PVAV); /* needs to be an AV type */
+    AvREAL_on((AV*)sv);
 
     /* pre-scan the imput string to check for decimals */
     while ( *pos == '.' || *pos == '_' || isDIGIT(*pos) )
@@ -4010,6 +4011,7 @@ Perl_new_version(pTHX_ SV *ver)
        AV *av = (AV *)SvRV(ver);
        SV* sv = newSVrv(rv, "version"); /* create an SV and upgrade the RV */
        (void)sv_upgrade(sv, SVt_PVAV); /* needs to be an AV type */
+       AvREAL_on((AV*)sv);
        for ( key = 0; key <= av_len(av); key++ )
        {
            I32 rev = SvIV(*av_fetch(av, key, FALSE));