From: Chris Heath Date: Sun, 6 Nov 2005 20:08:05 +0000 (-0800) Subject: [perl #24254] Attempt to free unreferenced scalar X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=21401c75f1c38e127fa870b81fca15879c466865;p=p5sagit%2Fp5-mst-13.2.git [perl #24254] Attempt to free unreferenced scalar From: "Chris Heath via RT" Message-ID: p4raw-id: //depot/perl@26027 --- diff --git a/cop.h b/cop.h index f2e4463..47c2375 100644 --- a/cop.h +++ b/cop.h @@ -407,9 +407,14 @@ struct block_loop { #define POPLOOP(cx) \ SvREFCNT_dec(cx->blk_loop.iterlval); \ if (CxITERVAR(cx)) { \ - SV **s_v_p = CxITERVAR(cx); \ - sv_2mortal(*s_v_p); \ - *s_v_p = cx->blk_loop.itersave; \ + if (SvPADMY(cx->blk_loop.itersave)) { \ + SV **s_v_p = CxITERVAR(cx); \ + sv_2mortal(*s_v_p); \ + *s_v_p = cx->blk_loop.itersave; \ + } \ + else { \ + SvREFCNT_dec(cx->blk_loop.itersave); \ + } \ } \ if (cx->blk_loop.iterary && cx->blk_loop.iterary != PL_curstack)\ SvREFCNT_dec(cx->blk_loop.iterary);