This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Fixed reference count loop caused by sv_magic. sv_magic is called
from gv_fetchpv to create single-character magic variables (e.g. $!),
and it is passed a sv and the gv that contains the sv as the mg_obj
value. When sv_magic stores the mg_obj pointer it increments the gv
refcount, thus causing a sv-gv pair that can't be freed. There is
already a check for sv == obj which is used to prevent such reference
loops. This change extends the check to cover the case described above.
p4raw-id: //depot/maint-5.6/pureperl@8868