This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
dooop.c: the strong asserts in Sv* macros could cause memory leakage -- move the...
authorJarkko Hietaniemi <jhi@iki.fi>
Mon, 17 Apr 2006 10:19:37 +0000 (13:19 +0300)
committerNicholas Clark <nick@ccl4.org>
Mon, 17 Apr 2006 11:37:38 +0000 (11:37 +0000)
Message-Id: <20060417071937.C13346CF2D@aprikoosi.hut.fi>
Date: Mon, 17 Apr 2006 10:19:37 +0300 (EEST)

p4raw-id: //depot/perl@27859

doop.c

diff --git a/doop.c b/doop.c
index 5972dbd..08b6c23 100644 (file)
--- a/doop.c
+++ b/doop.c
@@ -1197,6 +1197,8 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
     rsave = rc = SvPV_nomg_const(right, rightlen);
     len = leftlen < rightlen ? leftlen : rightlen;
     lensave = len;
+    SvCUR_set(sv, len);
+    (void)SvPOK_only(sv);
     if ((left_utf || right_utf) && (sv == left || sv == right)) {
        needlen = optype == OP_BIT_AND ? len : leftlen + rightlen;
        Newxz(dc, needlen + 1, char);
@@ -1217,8 +1219,6 @@ Perl_do_vop(pTHX_ I32 optype, SV *sv, SV *left, SV *right)
        sv_usepvn_flags(sv, dc, needlen, SV_HAS_TRAILING_NUL);
        dc = SvPVX(sv);         /* sv_usepvn() calls Renew() */
     }
-    SvCUR_set(sv, len);
-    (void)SvPOK_only(sv);
     if (left_utf || right_utf) {
        UV duc, luc, ruc;
        char *dcorig = dc;