summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gv.c9
-rw-r--r--intrpvar.h3
-rw-r--r--perl.c3
-rw-r--r--sv.c10
4 files changed, 11 insertions, 14 deletions
diff --git a/gv.c b/gv.c
index 291e2d112d..703635cabd 100644
--- a/gv.c
+++ b/gv.c
@@ -1232,10 +1232,10 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
if (strEQ(name2, "IG")) {
HV *hv;
I32 i;
- if (!PL_psig_ptr) {
- Newxz(PL_psig_ptr, SIG_SIZE, SV*);
- Newxz(PL_psig_name, SIG_SIZE, SV*);
+ if (!PL_psig_name) {
+ Newxz(PL_psig_name, 2 * SIG_SIZE, SV*);
Newxz(PL_psig_pend, SIG_SIZE, int);
+ PL_psig_ptr = PL_psig_name + SIG_SIZE;
} else {
/* I think that the only way to get here is to re-use an
embedded perl interpreter, where the previous
@@ -1246,8 +1246,7 @@ Perl_gv_fetchpvn_flags(pTHX_ const char *nambeg, STRLEN full_len, I32 flags,
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_name, 2 * SIG_SIZE, SV*);
Zero(PL_psig_pend, SIG_SIZE, int);
}
GvMULTI_on(gv);
diff --git a/intrpvar.h b/intrpvar.h
index 3265ac2ccf..7a0526811b 100644
--- a/intrpvar.h
+++ b/intrpvar.h
@@ -537,7 +537,8 @@ PERLVAR(Iparser, yy_parser *) /* current parser state */
signal handler dispatches. */
PERLVAR(Ipsig_ptr, SV**)
/* Array of names of signals, indexed by signal number, for (re)use as the first
- argument to a signal handler. */
+ argument to a signal handler. Only one block of memory is allocated for
+ both psig_name and psig_ptr. */
PERLVAR(Ipsig_name, SV**)
#if defined(PERL_IMPLICIT_SYS)
diff --git a/perl.c b/perl.c
index fa7a5e1b3e..73082ba476 100644
--- a/perl.c
+++ b/perl.c
@@ -1228,10 +1228,9 @@ perl_destruct(pTHXx)
Safefree(PL_reg_poscache);
free_tied_hv_pool();
Safefree(PL_op_mask);
- Safefree(PL_psig_ptr);
- PL_psig_ptr = (SV**)NULL;
Safefree(PL_psig_name);
PL_psig_name = (SV**)NULL;
+ PL_psig_ptr = (SV**)NULL;
Safefree(PL_psig_pend);
PL_psig_pend = (int*)NULL;
PL_formfeed = NULL;
diff --git a/sv.c b/sv.c
index b4084858b8..1dad3cf4c6 100644
--- a/sv.c
+++ b/sv.c
@@ -12185,13 +12185,11 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
PL_psig_pend = (int*)NULL;
}
- if (proto_perl->Ipsig_ptr) {
- Newx(PL_psig_ptr, SIG_SIZE, SV*);
- Newx(PL_psig_name, SIG_SIZE, SV*);
- sv_dup_inc_multiple(proto_perl->Ipsig_ptr, PL_psig_ptr, SIG_SIZE,
- param);
- sv_dup_inc_multiple(proto_perl->Ipsig_name, PL_psig_name, SIG_SIZE,
+ if (proto_perl->Ipsig_name) {
+ Newx(PL_psig_name, 2 * SIG_SIZE, SV*);
+ sv_dup_inc_multiple(proto_perl->Ipsig_name, PL_psig_name, 2 * SIG_SIZE,
param);
+ PL_psig_ptr = PL_psig_name + SIG_SIZE;
}
else {
PL_psig_ptr = (SV**)NULL;