summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-11-18 18:28:08 -0800
committerFather Chrysostomos <sprout@cpan.org>2010-11-20 18:15:13 -0800
commit4c2bfb4f71321bcaebd7aa164447958a33081791 (patch)
tree63c8f53e79f45014e3bdc693b9fb36a6ba5b6504 /hv.c
parent3a5c91344a6e5968c082c1ed4c366b743bcba459 (diff)
downloadperl-4c2bfb4f71321bcaebd7aa164447958a33081791.tar.gz
Fix hv_name_set when there is an HvENAME
This code was completely wrong and could even crash. This is not cur- rently reached.
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/hv.c b/hv.c
index 5c07d075f4..a3dd133180 100644
--- a/hv.c
+++ b/hv.c
@@ -2081,14 +2081,17 @@ Perl_hv_name_set(pTHX_ HV *hv, const char *name, U32 len, U32 flags)
iter->xhv_name_count = 0;
}
else {
- spot = (HEK **)iter->xhv_name;
if(iter->xhv_name_count > 0) {
/* shift some things over */
- Renew(spot, iter->xhv_name_count, HEK *);
- spot[iter->xhv_name_count++] = spot[1];
+ Renewc(
+ iter->xhv_name, iter->xhv_name_count + 1, HEK *, HEK
+ );
+ spot = (HEK **)iter->xhv_name;
+ spot[iter->xhv_name_count] = spot[1];
spot[1] = spot[0];
+ iter->xhv_name_count = -(iter->xhv_name_count + 1);
}
- else if(*spot) {
+ else if(*(spot = (HEK **)iter->xhv_name)) {
unshare_hek_or_pvn(*spot, 0, 0, 0);
}
}