summaryrefslogtreecommitdiff
path: root/gv.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2009-05-19 10:39:43 +0200
committerNicholas Clark <nick@ccl4.org>2009-05-19 10:39:43 +0200
commit0bdedcb34289d9e694301c7a38391d0730e0f2bc (patch)
treee1937ee1d54cb6bae2bd4cfdbb6ee15584a27942 /gv.c
parente92c6be8349ad1d36d6df1dcb526fd37421e9970 (diff)
downloadperl-0bdedcb34289d9e694301c7a38391d0730e0f2bc.tar.gz
In Perl_gv_fetchpvn_flags(), don't re-zero memory from Newxz().
Explicitly zero the memory for PL_psig_ptr, PL_psig_name and PL_psig_pend if we didn't need to allocate it this time round.
Diffstat (limited to 'gv.c')
-rw-r--r--gv.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/gv.c b/gv.c
index c22f73aa65..291e2d112d 100644
--- a/gv.c
+++ b/gv.c
@@ -1236,6 +1236,19 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
Newxz(PL_psig_ptr, SIG_SIZE, SV*);
Newxz(PL_psig_name, SIG_SIZE, SV*);
Newxz(PL_psig_pend, SIG_SIZE, int);
+ } else {
+ /* I think that the only way to get here is to re-use an
+ embedded perl interpreter, where the previous
+ use didn't clean up fully because
+ PL_perl_destruct_level was 0. I'm not sure that we
+ "support" that, in that I suspect in that scenario
+ there are sufficient other garbage values left in the
+ interpreter structure that something else will crash
+ before we get here. I suspect that this is one of
+ those "doctor, it hurts when I do this" bugs. */
+ Zero(PL_psig_ptr, SIG_SIZE, SV*);
+ Zero(PL_psig_name, SIG_SIZE, SV*);
+ Zero(PL_psig_pend, SIG_SIZE, int);
}
GvMULTI_on(gv);
hv = GvHVn(gv);
@@ -1244,9 +1257,6 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
SV * const * const init = hv_fetch(hv, PL_sig_name[i], strlen(PL_sig_name[i]), 1);
if (init)
sv_setsv(*init, &PL_sv_undef);
- PL_psig_ptr[i] = 0;
- PL_psig_name[i] = 0;
- PL_psig_pend[i] = 0;
}
}
break;