From: Nicholas Clark <nick@ccl4.org>
Date: Fri, 15 Jan 2010 16:29:56 +0000 (+0000)
Subject: Avoid a double SV leak in an error state branch of pp_require.
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=af61dbfdfb97af17b1150478d07da724cd530424;p=p5sagit%2Fp5-mst-13.2.git

Avoid a double SV leak in an error state branch of pp_require.

Avoid using a sprintf format for a constant value (0).
---

diff --git a/pp_ctl.c b/pp_ctl.c
index 81a942f..d5f2f5d 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3275,21 +3275,21 @@ PP(pp_require)
 			SVfARG(vnormal(PL_patchlevel)));
 		}
 		else { /* probably 'use 5.10' or 'use 5.8' */
-		    SV * hintsv = newSV(0);
+		    SV *hintsv;
 		    I32 second = 0;
 
 		    if (av_len(lav)>=1) 
 			second = SvIV(*av_fetch(lav,1,0));
 
 		    second /= second >= 600  ? 100 : 10;
-		    hintsv = Perl_newSVpvf(aTHX_ "v%d.%d.%d",
-		    	(int)first, (int)second,0);
+		    hintsv = Perl_newSVpvf(aTHX_ "v%d.%d.0",
+					   (int)first, (int)second);
 		    upg_version(hintsv, TRUE);
 
 		    DIE(aTHX_ "Perl %"SVf" required (did you mean %"SVf"?)"
 		    	"--this is only %"SVf", stopped",
 			SVfARG(vnormal(req)),
-			SVfARG(vnormal(hintsv)),
+			SVfARG(vnormal(sv_2mortal(hintsv))),
 			SVfARG(vnormal(PL_patchlevel)));
 		}
 	    }