/* scope.c
*
- * Copyright (c) 1991-2000, Larry Wall
+ * Copyright (c) 1991-2001, Larry Wall
*
* You may distribute under the terms of either the GNU General Public
* License or the Artistic License, as specified in the README file.
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;
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;
ptr = SSPOPPTR;
(void)hv_delete(hv, (char*)ptr, (U32)SSPOPINT, G_DISCARD);
SvREFCNT_dec(hv);
+ Safefree(ptr);
break;
case SAVEt_DESTRUCTOR:
ptr = SSPOPPTR;
PL_op = (OP*)SSPOPPTR;
break;
case SAVEt_HINTS:
- if (GvHV(PL_hintgv)) {
- SvREFCNT_dec((SV*)GvHV(PL_hintgv));
- GvHV(PL_hintgv) = NULL;
- }
*(I32*)&PL_hints = (I32)SSPOPINT;
break;
case SAVEt_COMPPAD: