From: Nicholas Clark Date: Tue, 24 May 2005 15:21:48 +0000 (+0000) Subject: Leaking is bad, m'kay. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=16580ff596d3844ac4e62fa769c913cc47285a8f;p=p5sagit%2Fp5-mst-13.2.git Leaking is bad, m'kay. p4raw-id: //depot/perl@24566 --- diff --git a/hv.c b/hv.c index 2996a8e..5443771 100644 --- a/hv.c +++ b/hv.c @@ -1596,6 +1596,7 @@ S_hfreeentries(pTHX_ HV *hv) HvLAZYDEL_off(hv); hv_free_ent(hv, entry); } + Safefree(iter->xhv_name); Safefree(iter); ((XPVHV*) SvANY(hv))->xhv_aux = 0; } @@ -1772,7 +1773,9 @@ Perl_hv_name_set(pTHX_ HV *hv, const char *name, STRLEN len, int flags) { struct xpvhv_aux *iter = ((XPVHV *)SvANY(hv))->xhv_aux; - if (!iter) { + if (iter) { + Safefree(iter->xhv_name); + } else { if (name == 0) return; diff --git a/sv.c b/sv.c index 718ecfe..b3e3d94 100644 --- a/sv.c +++ b/sv.c @@ -10915,15 +10915,13 @@ Perl_sv_dup(pTHX_ SV *sstr, CLONE_PARAMS* param) const char *hvname = HvNAME_get((HV*)sstr); struct xpvhv_aux *aux = ((XPVHV *)SvANY(sstr))->xhv_aux; + ((XPVHV *)SvANY(dstr))->xhv_aux = 0; if (aux) { - New(0, ((XPVHV *)SvANY(dstr))->xhv_aux, 1, struct xpvhv_aux); HvRITER_set((HV*)dstr, HvRITER_get((HV*)sstr)); /* FIXME strlen HvNAME */ Perl_hv_name_set(aTHX_ (HV*) dstr, hvname, hvname ? strlen(hvname) : 0, 0); - } else { - ((XPVHV *)SvANY(dstr))->xhv_aux = 0; } if (HvARRAY((HV*)sstr)) { STRLEN i = 0;