summaryrefslogtreecommitdiff
path: root/mro.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2010-11-10 09:43:21 -0800
committerFather Chrysostomos <sprout@cpan.org>2010-11-10 22:36:13 -0800
commitdf5f182b2f0708f51f91b8d390f65db1df18e143 (patch)
tree0a7dd2013f8b0ae84d17248fbd0478fb13559e6a /mro.c
parent1810cd7c230c5a59515b35da6bad19ff8c8a9d5b (diff)
downloadperl-df5f182b2f0708f51f91b8d390f65db1df18e143.tar.gz
Fix memory leaks in mro_package_moved
This commit adds a new HV_FETCH_EMPTY_HE flag for hv_common. It is to be used in conjunction with HV_FETCH_LVALUE. It just stops the newly- created HE from having a new undef scalar assigned to it. This allows code to call hv_common just once instead of an hv_exists/ hv_store pair. It was such a double hv_common call that I was trying to avoid with HV_FETCH_LVALUE, without realising that it was leaking.
Diffstat (limited to 'mro.c')
-rw-r--r--mro.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mro.c b/mro.c
index 47f99e4129..750699415f 100644
--- a/mro.c
+++ b/mro.c
@@ -831,7 +831,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV *stash, HV *oldstash,
= (HE *)
hv_common(
stashes, NULL, (const char *)&oldstash, sizeof(HV *), 0,
- HV_FETCH_LVALUE, NULL, 0
+ HV_FETCH_LVALUE|HV_FETCH_EMPTY_HE, NULL, 0
);
if(HeVAL(entry) == (SV *)oldstash) {
oldstash = NULL;
@@ -887,7 +887,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV *stash, HV *oldstash,
= (HE *)
hv_common(
stashes, NULL, (const char *)&stash, sizeof(HV *), 0,
- HV_FETCH_LVALUE, NULL, 0
+ HV_FETCH_LVALUE|HV_FETCH_EMPTY_HE, NULL, 0
);
if(HeVAL(entry) == &PL_sv_yes || HeVAL(entry) == (SV *)stash)
stash = NULL;
@@ -918,7 +918,7 @@ S_mro_gather_and_rename(pTHX_ HV * const stashes, HV *stash, HV *oldstash,
= (HE *)
hv_common(
stashes, NULL, (const char *)&revstash, sizeof(HV *), 0,
- HV_FETCH_LVALUE, NULL, 0
+ HV_FETCH_LVALUE|HV_FETCH_EMPTY_HE, NULL, 0
);
HeVAL(entry) = (SV *)revstash;