From c111d5f1ab8852c556adefbb6b416fd22274677c Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Mon, 11 Apr 2011 20:14:34 +0100 Subject: [PATCH] Allocate MADPROPs using PerlMemShared_malloc() As the MADPROPs are referenced from the optree, which is itself shared, MADPROPs can't use the default malloc(), which is per i-thread, lest a child thread frees the optree, and bad things(tm) happen. (a "free to wrong pool" panic if you're on Win32, or elsewhere if you've got DEBUGGING) --- op.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/op.c b/op.c index e21b9a4..5740aa6 100644 --- a/op.c +++ b/op.c @@ -3139,8 +3139,7 @@ Perl_newMADsv(pTHX_ char key, SV* sv) MADPROP * Perl_newMADPROP(pTHX_ char key, char type, void* val, I32 vlen) { - MADPROP *mp; - Newxz(mp, 1, MADPROP); + MADPROP *const mp = (MADPROP *) PerlMemShared_malloc(sizeof(MADPROP)); mp->mad_next = 0; mp->mad_key = key; mp->mad_vlen = vlen; @@ -3177,7 +3176,7 @@ Perl_mad_free(pTHX_ MADPROP* mp) PerlIO_printf(PerlIO_stderr(), "Unrecognized mad\n"); break; } - Safefree(mp); + PerlMemShared_free(mp); } #endif -- 1.8.3.1