Change 27668 by [EMAIL PROTECTED] on 2006/04/01 23:34:10

        If the passed in target rv for Perl_newSVrv() was already a reference
        to something, it would leak the reference count on that thing.

Affected files ...

... //depot/perl/sv.c#1220 edit

Differences ...

==== //depot/perl/sv.c#1220 (text) ====
Index: perl/sv.c
--- perl/sv.c#1219~27657~       2006-04-01 04:32:23.000000000 -0800
+++ perl/sv.c   2006-04-01 15:34:10.000000000 -0800
@@ -7688,9 +7688,11 @@
        sv_clear(rv);
        SvFLAGS(rv) = 0;
        SvREFCNT(rv) = refcnt;
-    }
 
-    if (SvTYPE(rv) < SVt_RV)
+       sv_upgrade(rv, SVt_RV);
+    } else if (SvROK(rv)) {
+       SvREFCNT_dec(SvRV(rv));
+    } else if (SvTYPE(rv) < SVt_RV)
        sv_upgrade(rv, SVt_RV);
     else if (SvTYPE(rv) > SVt_RV) {
        SvPV_free(rv);
End of Patch.

Reply via email to