summaryrefslogtreecommitdiff
path: root/hv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-05-04 18:53:39 +0100
committerNicholas Clark <nick@ccl4.org>2009-05-04 18:53:39 +0100
commit566771cc1208eb7c5c8363435c4bd1299f0ae5e5 (patch)
tree4ce4883dab8dd75b0687434d3d6dd7d4411f50c2 /hv.c
parent1dffc4d1a24556f4e23f612d6713492847ff064b (diff)
downloadperl-566771cc1208eb7c5c8363435c4bd1299f0ae5e5.tar.gz
Make Perl_hek_dup() cope with a NULL "source" parameter (by returning NULL).
Change its callers to take advantage of this.
Diffstat (limited to 'hv.c')
-rw-r--r--hv.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/hv.c b/hv.c
index 79f59730a9..e3dee46de1 100644
--- a/hv.c
+++ b/hv.c
@@ -134,11 +134,15 @@ Perl_free_tied_hv_pool(pTHX)
HEK *
Perl_hek_dup(pTHX_ HEK *source, CLONE_PARAMS* param)
{
- HEK *shared = (HEK*)ptr_table_fetch(PL_ptr_table, source);
+ HEK *shared;
PERL_ARGS_ASSERT_HEK_DUP;
PERL_UNUSED_ARG(param);
+ if (!source)
+ return NULL;
+
+ shared = (HEK*)ptr_table_fetch(PL_ptr_table, source);
if (shared) {
/* We already shared this hash key. */
(void)share_hek_hek(shared);