Skip to content

Commit

Permalink
hv_delete_common was freeing the key, then passing the freed pointer
Browse files Browse the repository at this point in the history
to S_hv_notallowed. D'oh!

p4raw-id: //depot/perl@22569
  • Loading branch information
nwc10 committed Mar 23, 2004
1 parent 32454ac commit b84d086
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions hv.c
Expand Up @@ -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;
Expand Down

0 comments on commit b84d086

Please sign in to comment.