From: Nicholas Clark Date: Sat, 7 Apr 2007 20:43:14 +0000 (+0000) Subject: Ensure PL_last_in_gv doesn't end up pointing to garbage by NULLing it X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=8571fe2faa23f15e20b624e04cae5d59c8ae7242;p=p5sagit%2Fp5-mst-13.2.git Ensure PL_last_in_gv doesn't end up pointing to garbage by NULLing it if the GV it is pointing to gets freed. p4raw-id: //depot/perl@30868 --- diff --git a/sv.c b/sv.c index 09dec1f..5d84cb3 100644 --- a/sv.c +++ b/sv.c @@ -5144,6 +5144,11 @@ Perl_sv_clear(pTHX_ register SV *sv) if (!SvVALID(sv) && GvSTASH(sv)) sv_del_backref((SV*)GvSTASH(sv), sv); } + /* FIXME. There are probably more unreferenced pointers to SVs in the + interpreter struct that we should check and tidy in a similar + fashion to this: */ + if ((GV*)sv == PL_last_in_gv) + PL_last_in_gv = NULL; case SVt_PVMG: case SVt_PVNV: case SVt_PVIV: