From: Jerry D. Hedden Date: Mon, 20 Nov 2006 07:32:36 +0000 (-0800) Subject: Re: thread free problem X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c299b123cd6e3886232946bdd1358fb0b6b7a0a6;p=p5sagit%2Fp5-mst-13.2.git Re: thread free problem From: "Jerry D. Hedden" Message-ID: <696736.39963.qm@web30204.mail.mud.yahoo.com> p4raw-id: //depot/perl@29329 --- diff --git a/op.c b/op.c index 5325a5a..32bf1d8 100644 --- a/op.c +++ b/op.c @@ -490,7 +490,16 @@ clear_pmop: STATIC void S_cop_free(pTHX_ COP* cop) { - Safefree(cop->cop_label); /* FIXME: treaddead ??? */ + if (cop->cop_label) { +#ifdef PERL_TRACK_MEMPOOL + Malloc_t ptr = (Malloc_t)(cop->cop_label - sTHX); + struct perl_memory_debug_header *const header + = (struct perl_memory_debug_header *)ptr; + /* Only the thread that allocated us can free us. */ + if (header->interpreter == aTHX) +#endif + Safefree(cop->cop_label); + } CopFILE_free(cop); CopSTASH_free(cop); if (! specialWARN(cop->cop_warnings))