develooper Front page | perl.perl5.porters | Postings from April 2006

[PATCH] dooop.c: the strong asserts in Sv* macros could cause memory leakage -- move the macro calls earlier (Coverity CID 84)

Thread Next
From:
jhi
Date:
April 17, 2006 00:22
Subject:
[PATCH] 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
--- doop.c.dist	2006-04-17 10:16:19.000000000 +0300
+++ doop.c	2006-04-17 10:16:30.000000000 +0300
@@ -1197,6 +1197,8 @@
     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 @@
 	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;

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About