fix a coredump caused by rv2gv not fully converting a PV to an RV
Dave Mitchell [Tue, 27 Apr 2004 22:21:35 +0000 (22:21 +0000)]
p4raw-id: //depot/perl@22746

pp.c

diff --git a/pp.c b/pp.c
index 6a17ece..1a35902 100644 (file)
--- a/pp.c
+++ b/pp.c
@@ -168,6 +168,12 @@ PP(pp_rv2gv)
                    }
                    if (SvTYPE(sv) < SVt_RV)
                        sv_upgrade(sv, SVt_RV);
+                   if (SvPVX(sv)) {
+                       (void)SvOOK_off(sv);            /* backoff */
+                       if (SvLEN(sv))
+                           Safefree(SvPVX(sv));
+                       SvLEN(sv)=SvCUR(sv)=0;
+                   }
                    SvRV(sv) = (SV*)gv;
                    SvROK_on(sv);
                    SvSETMAGIC(sv);