With mallocwrap New() evaluates its arguments more than once, so they
Nicholas Clark [Sat, 5 Feb 2005 21:47:35 +0000 (21:47 +0000)]
had better not have any side effects.
:-(

p4raw-id: //depot/perl@23941

util.c

diff --git a/util.c b/util.c
index 85ae19f..e90d195 100644 (file)
--- a/util.c
+++ b/util.c
@@ -835,7 +835,8 @@ Perl_savesvpv(pTHX_ SV *sv)
     const char *pv = SvPV(sv, len);
     register char *newaddr;
 
-    New(903,newaddr,++len,char);
+    ++len;
+    New(903,newaddr,len,char);
     return CopyD(pv,newaddr,len,char);
 }