summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hv.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/hv.c b/hv.c
index 7115332c92..601f52fc51 100644
--- a/hv.c
+++ b/hv.c
@@ -381,6 +381,8 @@ S_hv_fetch_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
return 0;
if (keysv) {
+ if (flags & HVhek_FREEKEY)
+ Safefree(key);
key = SvPV(keysv, klen);
flags = 0;
is_utf8 = (SvUTF8(keysv) != 0);
@@ -873,6 +875,8 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen,
return Nullsv;
if (keysv) {
+ if (k_flags & HVhek_FREEKEY)
+ Safefree(key);
key = SvPV(keysv, klen);
k_flags = 0;
is_utf8 = (SvUTF8(keysv) != 0);