diff options
author | Nicholas Clark <nick@ccl4.org> | 2006-04-12 22:45:12 +0000 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2006-04-12 22:45:12 +0000 |
commit | 72dc9ed5af65c946f73050becea29207a1af86c1 (patch) | |
tree | 77d02ca4340063d7184142085f9527f83a40992e /perl.c | |
parent | aa283a383ef6540d57dd786b93d8ba9bd303e3e6 (diff) | |
download | perl-72dc9ed5af65c946f73050becea29207a1af86c1.tar.gz |
Change cop_warnings from an SV holding the warnings bitmask to a
directly (shared) malloc()ed buffer holding the warnings bitmask.
This avoids bugs/crashes when the interpreter that created an optree
is freed but the optree remains in use by other interpreters.
p4raw-id: //depot/perl@27779
Diffstat (limited to 'perl.c')
-rw-r--r-- | perl.c | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -1035,7 +1035,7 @@ perl_destruct(pTHXx) PL_utf8_idcont = NULL; if (!specialWARN(PL_compiling.cop_warnings)) - SvREFCNT_dec(PL_compiling.cop_warnings); + PerlMemShared_free(PL_compiling.cop_warnings); PL_compiling.cop_warnings = NULL; if (!specialCopIO(PL_compiling.cop_io)) SvREFCNT_dec(PL_compiling.cop_io); @@ -2037,7 +2037,8 @@ S_parse_body(pTHX_ char **env, XSINIT_t xsinit) #endif if (PL_taint_warn && PL_dowarn != G_WARN_ALL_OFF) { - PL_compiling.cop_warnings = newSVpvn(WARN_TAINTstring, WARNsize); + PL_compiling.cop_warnings + = Perl_new_warnings_bitfield(NULL, WARN_TAINTstring, WARNsize); } if (!scriptname) @@ -3369,14 +3370,14 @@ Internet, point your browser at http://www.perl.org/, the Perl Home Page.\n\n"); case 'W': PL_dowarn = G_WARN_ALL_ON|G_WARN_ON; if (!specialWARN(PL_compiling.cop_warnings)) - SvREFCNT_dec(PL_compiling.cop_warnings); + PerlMemShared_free(PL_compiling.cop_warnings); PL_compiling.cop_warnings = pWARN_ALL ; s++; return s; case 'X': PL_dowarn = G_WARN_ALL_OFF; if (!specialWARN(PL_compiling.cop_warnings)) - SvREFCNT_dec(PL_compiling.cop_warnings); + PerlMemShared_free(PL_compiling.cop_warnings); PL_compiling.cop_warnings = pWARN_NONE ; s++; return s; |