From: David Mitchell Date: Mon, 6 Jun 2011 18:09:31 +0000 (+0100) Subject: [perl #90006] out of memory during thread clone X-Git-Tag: accepted/trunk/20130322.191538~3929 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f144f1e3c6a65ce611177737a21b1166f07ef373;p=platform%2Fupstream%2Fperl.git [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. --- diff --git a/pp_ctl.c b/pp_ctl.c index 043bef3..eed88f8 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];