From: Nicholas Clark Date: Fri, 27 Oct 2006 21:40:40 +0000 (+0000) Subject: Change 27779 failed to free() memory in two places in Perl_magic_set(), X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=4243c432ee3fbfe1fc81b006c97c0de452702db0;p=p5sagit%2Fp5-mst-13.2.git Change 27779 failed to free() memory in two places in Perl_magic_set(), and hence was leaking like the proverbial Jumblie maritime craft. p4raw-id: //depot/perl@29127 --- diff --git a/mg.c b/mg.c index 7c19c7e..425190b 100644 --- a/mg.c +++ b/mg.c @@ -2304,11 +2304,16 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) accumulate |= ptr[i] ; any_fatals |= (ptr[i] & 0xAA) ; } - if (!accumulate) - PL_compiling.cop_warnings = pWARN_NONE; + if (!accumulate) { + if (!specialWARN(PL_compiling.cop_warnings)) + PerlMemShared_free(PL_compiling.cop_warnings); + PL_compiling.cop_warnings = pWARN_NONE; + } /* Yuck. I can't see how to abstract this: */ else if (isWARN_on(((STRLEN *)SvPV_nolen_const(sv)) - 1, WARN_ALL) && !any_fatals) { + if (!specialWARN(PL_compiling.cop_warnings)) + PerlMemShared_free(PL_compiling.cop_warnings); PL_compiling.cop_warnings = pWARN_ALL; PL_dowarn |= G_WARN_ONCE ; }