summaryrefslogtreecommitdiff
path: root/mg.c
diff options
context:
space:
mode:
authorDave Mitchell <davem@fdisolutions.com>2003-08-20 21:44:53 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2003-08-21 04:35:05 +0000
commit58f82c5ce8b2d8cb469c0b41ae0ab2e192854d6f (patch)
tree4a73d4e256478ad3cfa5066a12230246d86beaca /mg.c
parentca337316984db69ef8c629fa7228a5d8e486f363 (diff)
downloadperl-58f82c5ce8b2d8cb469c0b41ae0ab2e192854d6f.tar.gz
Re: untieing your victim during the act
Message-ID: <20030820194453.GD27719@fdgroup.com> p4raw-id: //depot/perl@20793
Diffstat (limited to 'mg.c')
-rw-r--r--mg.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mg.c b/mg.c
index 6f92bb5bfe..8a40a76ea5 100644
--- a/mg.c
+++ b/mg.c
@@ -139,6 +139,10 @@ Perl_mg_get(pTHX_ SV *sv)
if (SvTYPE(sv) == SVTYPEMASK) {
Perl_croak(aTHX_ "Tied variable freed while still in use");
}
+ /* guard against magic having been deleted - eg FETCH calling
+ * untie */
+ if (!SvMAGIC(sv))
+ break;
/* Don't restore the flags for this entry if it was deleted. */
if (mg->mg_flags & MGf_GSKIP)
@@ -1459,9 +1463,9 @@ S_magic_methpack(pTHX_ SV *sv, MAGIC *mg, char *meth)
int
Perl_magic_getpack(pTHX_ SV *sv, MAGIC *mg)
{
- magic_methpack(sv,mg,"FETCH");
if (mg->mg_ptr)
mg->mg_flags |= MGf_GSKIP;
+ magic_methpack(sv,mg,"FETCH");
return 0;
}