summaryrefslogtreecommitdiff
path: root/scope.c
diff options
context:
space:
mode:
authorJarkko Hietaniemi <jhi@iki.fi>2001-03-14 03:50:38 +0000
committerJarkko Hietaniemi <jhi@iki.fi>2001-03-14 03:50:38 +0000
commit5cfc78421f161e223f47fcc0aa3d4d3fa5f3976e (patch)
tree2ef2cd4539bb6af01a562976c217e5ddfe2089a4 /scope.c
parentc6a6ba88b188e56556e838218408788ec13954d4 (diff)
downloadperl-5cfc78421f161e223f47fcc0aa3d4d3fa5f3976e.tar.gz
Integrate changes #9137,9138,9142 from maintperl into mainline.
fix leak in pregcomp() when RE fails to compile (e.g. m/\\/) remove squelch controls for "Scalars leaked" messages in most places (these are now cured) fix another memory leak reported by purify (tie callbacks that croak can leak when wiping out magic) p4raw-link: @9142 on //depot/maint-5.6/perl: 26972843796e21c404c9d13ec5ee86e7b952a2bd p4raw-link: @9138 on //depot/maint-5.6/perl: ad7f1144250940f9ca43bac32708ec5e718b30ff p4raw-link: @9137 on //depot/maint-5.6/perl: 1f35595ecca168b4f66e3399344799fdbd496d17 p4raw-id: //depot/perl@9144 p4raw-integrated: from //depot/maint-5.6/perl@9143 'copy in' t/pragma/strict-vars (@7318..) t/pragma/warn/regcomp (@7887..) t/op/regexp.t (@8551..) t/op/lex_assign.t (@8987..) 'merge in' t/op/local.t (@5902..) t/pragma/warn/op (@7846..) t/pragma/warnings.t (@7895..) t/comp/proto.t (@8173..) t/pragma/warn/toke (@8570..) regcomp.c (@8777..) scope.c (@8855..) t/op/pat.t (@9076..)
Diffstat (limited to 'scope.c')
-rw-r--r--scope.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/scope.c b/scope.c
index f0efaf82e0..106b3dc253 100644
--- a/scope.c
+++ b/scope.c
@@ -196,7 +196,7 @@ S_save_scalar_at(pTHX_ SV **sptr)
if (SvGMAGICAL(osv)) {
MAGIC* mg;
bool oldtainted = PL_tainted;
- mg_get(osv);
+ mg_get(osv); /* note, can croak! */
if (PL_tainting && PL_tainted && (mg = mg_find(osv, 't'))) {
SAVESPTR(mg->mg_obj);
mg->mg_obj = osv;
@@ -678,13 +678,19 @@ Perl_leave_scope(pTHX_ I32 base)
SvMAGICAL_off(sv);
SvMAGIC(sv) = 0;
}
+ /* XXX this branch is pretty bogus--note that we seem to
+ * only get here if the mg_get() in save_scalar_at() ends
+ * up croaking. This code irretrievably clears(!) the magic
+ * on the SV to avoid further croaking that might ensue
+ * when the SvSETMAGIC() below is called. This needs a
+ * total rethink. --GSAR */
else if (SvTYPE(value) >= SVt_PVMG && SvMAGIC(value) &&
SvTYPE(value) != SVt_PVGV)
{
SvFLAGS(value) |= (SvFLAGS(value) &
(SVp_IOK|SVp_NOK|SVp_POK)) >> PRIVSHIFT;
SvMAGICAL_off(value);
- SvMAGIC(value) = 0;
+ mg_free(value);
}
SvREFCNT_dec(sv);
*(SV**)ptr = value;