summaryrefslogtreecommitdiff
path: root/perl.c
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-04-12 22:45:12 +0000
committerNicholas Clark <nick@ccl4.org>2006-04-12 22:45:12 +0000
commit72dc9ed5af65c946f73050becea29207a1af86c1 (patch)
tree77d02ca4340063d7184142085f9527f83a40992e /perl.c
parentaa283a383ef6540d57dd786b93d8ba9bd303e3e6 (diff)
downloadperl-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.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/perl.c b/perl.c
index bd667eee7b..83baacea04 100644
--- a/perl.c
+++ b/perl.c
@@ -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;