summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-10-27 21:40:40 +0000
committerNicholas Clark <nick@ccl4.org>2006-10-27 21:40:40 +0000
commit4243c432ee3fbfe1fc81b006c97c0de452702db0 (patch)
tree578338eea6c003d08d723fba822a4980492e80d0 /mg.c
parent267d554123ae974ccd717e77510a6c3e0691dab2 (diff)
downloadperl-4243c432ee3fbfe1fc81b006c97c0de452702db0.tar.gz
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
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/mg.c b/mg.c
index 7c19c7e1d9..425190b974 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 ;
}