summaryrefslogtreecommitdiff
path: root/sv.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2011-06-06 17:15:09 +0100
committerDavid Mitchell <davem@iabyn.com>2011-06-06 19:44:35 +0100
commit50f626ad600f0bdc3dd1e79057149c3dca9e2f45 (patch)
tree211757efc2dadb5e0e04aa627f7f817555c8e0cc /sv.c
parent692fcd37585c5b7f1e0e1a30148e0451f2f963eb (diff)
downloadperl-50f626ad600f0bdc3dd1e79057149c3dca9e2f45.tar.gz
[perl #90006] cloning crashes during Out of Memory
Perl's malloc has a $^M facility to create an emergency memory allocation during an Out Of Memory crisis. This requires accessing PL_defstash. In perl_clone_using(), in debugging builds, the Idefstash field was intially poisoned, and before it had a chance to be properly initialised, malloc() may have been called. Fix this by initialising PL_defstash to NULL early on.
Diffstat (limited to 'sv.c')
-rw-r--r--sv.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/sv.c b/sv.c
index f0d7253170..d75bfbe658 100644
--- a/sv.c
+++ b/sv.c
@@ -12822,6 +12822,7 @@ perl_clone_using(PerlInterpreter *proto_perl, UV flags,
PoisonNew(my_perl, 1, PerlInterpreter);
PL_op = NULL;
PL_curcop = NULL;
+ PL_defstash = NULL; /* may be used by perl malloc() */
PL_markstack = 0;
PL_scopestack = 0;
PL_scopestack_name = 0;