From: Gurusamy Sarathy Date: Sat, 18 Jul 1998 08:48:13 +0000 (+0000) Subject: fix yet another USE_THREADS leak due to failure to free stacks X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f7ac0805bb97e1e2d7fa37a2ffc86ce9bd5c6350;p=p5sagit%2Fp5-mst-13.2.git fix yet another USE_THREADS leak due to failure to free stacks p4raw-id: //depot/perl@1531 --- diff --git a/ext/Thread/Thread.xs b/ext/Thread/Thread.xs index 5d47cd0..34aee1b 100644 --- a/ext/Thread/Thread.xs +++ b/ext/Thread/Thread.xs @@ -150,11 +150,20 @@ threadstart(void *arg) SvREFCNT_dec(thr->errsv); SvREFCNT_dec(thr->errhv); + /*Safefree(cxstack);*/ + while (curstackinfo->si_next) + curstackinfo = curstackinfo->si_next; + while (curstackinfo) { + PERL_SI *p = curstackinfo->si_prev; + SvREFCNT_dec(curstackinfo->si_stack); + Safefree(curstackinfo->si_cxstack); + Safefree(curstackinfo); + curstackinfo = p; + } Safefree(markstack); Safefree(scopestack); Safefree(savestack); Safefree(retstack); - Safefree(cxstack); Safefree(tmps_stack); Safefree(ofs); @@ -165,6 +174,7 @@ threadstart(void *arg) Safefree(screamnext); Safefree(reg_start_tmp); SvREFCNT_dec(lastscream); + /*SvREFCNT_dec(defoutgv);*/ MUTEX_LOCK(&thr->mutex); DEBUG_L(PerlIO_printf(PerlIO_stderr(), diff --git a/util.c b/util.c index eb52ee5..af6f137 100644 --- a/util.c +++ b/util.c @@ -2784,7 +2784,7 @@ new_struct_thread(struct perl_thread *t) curpm = t->Tcurpm; /* XXX No PMOP ref count */ nrs = newSVsv(t->Tnrs); rs = SvREFCNT_inc(nrs); - last_in_gv = (GV*)SvREFCNT_inc(t->Tlast_in_gv); + last_in_gv = Nullgv; ofslen = t->Tofslen; ofs = savepvn(t->Tofs, ofslen); defoutgv = (GV*)SvREFCNT_inc(t->Tdefoutgv);