From: Dave Mitchell Date: Fri, 6 Aug 2004 10:06:46 +0000 (+0000) Subject: remove leaks associated with version object change #23190 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f9be5ac81a1b4bd2859cd05fa3a616e17a46b37c;p=p5sagit%2Fp5-mst-13.2.git remove leaks associated with version object change #23190 p4raw-link: @23190 on //depot/perl: d7aa53827cc12fdf8a697328df844e16aaa58287 p4raw-id: //depot/perl@23198 --- diff --git a/gv.c b/gv.c index d9d16ed..7474e81 100644 --- 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 --- 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));