copy xhv_rand and xhv_last_rand in threads clone
authorDavid Mitchell <davem@iabyn.com>
Fri, 28 Feb 2014 14:37:13 +0000 (14:37 +0000)
committerDavid Mitchell <davem@iabyn.com>
Fri, 28 Feb 2014 14:37:13 +0000 (14:37 +0000)
valgrind complains about these fields being uninitialised when cloned into a
new thread, because they aren't copied. It's fairly harmless, since these
fields are just used to perturb hash key iteration; but for completeness,
clone these fields too.

sv.c

diff --git a/sv.c b/sv.c
index a0e0c5f..b7563b9 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -12616,6 +12616,10 @@ S_sv_dup_common(pTHX_ const SV *const sstr, CLONE_PARAMS *const param)
 
                        daux->xhv_fill_lazy = saux->xhv_fill_lazy;
                        daux->xhv_aux_flags = saux->xhv_aux_flags;
+#ifdef PERL_HASH_RANDOMIZE_KEYS
+                       daux->xhv_rand = saux->xhv_rand;
+                       daux->xhv_last_rand = saux->xhv_last_rand;
+#endif
                        daux->xhv_riter = saux->xhv_riter;
                        daux->xhv_eiter = saux->xhv_eiter
                            ? he_dup(saux->xhv_eiter,