summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2011-06-06 19:09:31 +0100
committerDavid Mitchell <davem@iabyn.com>2011-06-06 19:44:35 +0100
commitf144f1e3c6a65ce611177737a21b1166f07ef373 (patch)
tree598314e72d78bb9a268a7e0443575b75e37594c7 /pp_ctl.c
parent50f626ad600f0bdc3dd1e79057149c3dca9e2f45 (diff)
downloadperl-f144f1e3c6a65ce611177737a21b1166f07ef373.tar.gz
[perl #90006] out of memory during thread clone
If you run out of memory during thread cloning, exit() may be called which will unwind the context stacks, and be very unhappy if there aren't any. Which there might not be if we haven't allocated any yet during cloning. We can't just fix this by creating them earlier during the cloning sequence, because creating them requires calling malloc(), which may fail and exit... So just check for this condition during stack unwind.
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index 043bef3b6b..eed88f8e0a 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -1577,6 +1577,9 @@ Perl_dounwind(pTHX_ I32 cxix)
dVAR;
I32 optype;
+ if (!PL_curstackinfo) /* can happen if die during thread cloning */
+ return;
+
while (cxstack_ix > cxix) {
SV *sv;
register PERL_CONTEXT *cx = &cxstack[cxstack_ix];