Re: [ID 20000704.002] [PATCH] memory leak with debug / anon subs
M. J. T. Guy [Fri, 7 Jul 2000 17:57:16 +0000 (18:57 +0100)]
Message-Id: <E13AbRE-00009T-00@libra.cus.cam.ac.uk>

p4raw-id: //depot/cfgperl@6341

pp_hot.c

index d45adca..6df5420 100644 (file)
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -2267,7 +2267,9 @@ S_get_db_sub(pTHX_ SV **svp, CV *cv)
                    && (gv = (GV*)*svp) ))) {
            /* Use GV from the stack as a fallback. */
            /* GV is potentially non-unique, or contain different CV. */
-           sv_setsv(dbsv, newRV((SV*)cv));
+           SV *tmp = newRV((SV*)cv));
+           sv_setsv(dbsv, tmp);
+           SvREFCNT_dec(tmp);
        }
        else {
            gv_efullname3(dbsv, gv, Nullch);