summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorAndy Lester <andy@petdance.com>2006-04-10 18:51:50 -0500
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2006-04-11 07:54:23 +0000
commitd39614506f118e8a474f0a8c4b7f7cd7e0e74f51 (patch)
tree50de03e7f9adc557dbfbfa01caff494a35996ece /pp.c
parentb5a2f8d883d38be33345ce4afe970bc14be51e58 (diff)
downloadperl-d39614506f118e8a474f0a8c4b7f7cd7e0e74f51.tar.gz
Quiet a coverity problem
Message-ID: <20060411045150.GA1422@petdance.com> p4raw-id: //depot/perl@27763
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/pp.c b/pp.c
index 025c1347d8..b52be7c84b 100644
--- a/pp.c
+++ b/pp.c
@@ -4053,7 +4053,6 @@ PP(pp_splice)
I32 newlen;
I32 after;
I32 diff;
- SV **tmparyval = NULL;
const MAGIC * const mg = SvTIED_mg((SV*)ary, PERL_MAGIC_tied);
if (mg) {
@@ -4119,6 +4118,7 @@ PP(pp_splice)
}
if (diff < 0) { /* shrinking the area */
+ SV **tmparyval;
if (newlen) {
Newx(tmparyval, newlen, SV*); /* so remember insertion */
Copy(MARK, tmparyval, newlen, SV*);
@@ -4179,15 +4179,14 @@ PP(pp_splice)
}
}
else { /* no, expanding (or same) */
+ SV** tmparyval = NULL;
if (length) {
Newx(tmparyval, length, SV*); /* so remember deletion */
Copy(AvARRAY(ary)+offset, tmparyval, length, SV*);
}
if (diff > 0) { /* expanding */
-
/* push up or down? */
-
if (offset < after && diff <= AvARRAY(ary) - AvALLOC(ary)) {
if (offset) {
src = AvARRAY(ary);
@@ -4228,7 +4227,6 @@ PP(pp_splice)
dst++;
}
}
- Safefree(tmparyval);
}
MARK += length - 1;
}
@@ -4239,10 +4237,10 @@ PP(pp_splice)
while (length-- > 0)
SvREFCNT_dec(tmparyval[length]);
}
- Safefree(tmparyval);
}
else
*MARK = &PL_sv_undef;
+ Safefree(tmparyval);
}
SP = MARK;
RETURN;