summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2004-03-23 17:47:44 +0000
committerNicholas Clark <nick@ccl4.org>2004-03-23 17:47:44 +0000
commitb84d08606128d31ab874c747150180e32486af44 (patch)
treeeaeb0974211cf665e2eae72fb2f782efc0336e0b /hv.c
parent32454ac83bb27c6d3bda46277aef34deb91a6f4d (diff)
downloadperl-b84d08606128d31ab874c747150180e32486af44.tar.gz
hv_delete_common was freeing the key, then passing the freed pointer
to S_hv_notallowed. D'oh! p4raw-id: //depot/perl@22569
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/hv.c b/hv.c
index cc642e0411..627140bf2a 100644
--- a/hv.c
+++ b/hv.c
@@ -977,19 +977,21 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
continue;
if ((HeKFLAGS(entry) ^ masked_flags) & HVhek_UTF8)
continue;
- if (k_flags & HVhek_FREEKEY)
- Safefree(key);
/* if placeholder is here, it's already been deleted.... */
if (HeVAL(entry) == &PL_sv_placeholder)
{
- return Nullsv;
+ if (k_flags & HVhek_FREEKEY)
+ Safefree(key);
+ return Nullsv;
}
else if (SvREADONLY(hv) && HeVAL(entry) && SvREADONLY(HeVAL(entry))) {
S_hv_notallowed(aTHX_ k_flags, key, klen,
"delete readonly key '%"SVf"' from"
);
}
+ if (k_flags & HVhek_FREEKEY)
+ Safefree(key);
if (d_flags & G_DISCARD)
sv = Nullsv;