From: Jarkko Hietaniemi Date: Mon, 17 Apr 2006 10:19:37 +0000 (+0300) Subject: dooop.c: the strong asserts in Sv* macros could cause memory leakage -- move the... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9fdd7463b7e8360d31fec7e9c836e5883fb01a87;p=p5sagit%2Fp5-mst-13.2.git dooop.c: the strong asserts in Sv* macros could cause memory leakage -- move the macro calls earlier (Coverity CID 84) Message-Id: <20060417071937.C13346CF2D@aprikoosi.hut.fi> Date: Mon, 17 Apr 2006 10:19:37 +0300 (EEST) p4raw-id: //depot/perl@27859 --- diff --git a/doop.c b/doop.c index 5972dbd..08b6c23 100644 --- 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;