diff options
author | David Mitchell <davem@iabyn.com> | 2019-03-25 17:18:58 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2019-03-25 20:32:21 +0000 |
commit | 1113f30d91f662c876a07b357666f02f04a30a75 (patch) | |
tree | 985ff5e87e004381b4fffce0e3aacf1b5310081d /mg.c | |
parent | 6256cf2c2cee30277e34d38416070f9ec671c989 (diff) | |
download | perl-1113f30d91f662c876a07b357666f02f04a30a75.tar.gz |
fix leak with local ${^WARNING_BITS} = ...
When restoring the old value, need to free the current value first.
Can be reproduced with
{
local ${^WARNING_BITS} = 'swit';
}
when run under ASan or similar.
An equivalent test already exists in t/op/leaky-magic.t.
Diffstat (limited to 'mg.c')
-rw-r--r-- | mg.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -2916,6 +2916,8 @@ Perl_magic_set(pTHX_ SV *sv, MAGIC *mg) else if (strEQ(mg->mg_ptr+1, "ARNING_BITS")) { if ( ! (PL_dowarn & G_WARN_ALL_MASK)) { if (!SvPOK(sv)) { + if (!specialWARN(PL_compiling.cop_warnings)) + PerlMemShared_free(PL_compiling.cop_warnings); PL_compiling.cop_warnings = pWARN_STD; break; } |