Change 32899 missed undoing the reference count increase when the SV
Nicholas Clark [Thu, 10 Jan 2008 23:32:27 +0000 (23:32 +0000)]
is popped off the AV.
"There's Something Wrong with our Bloody Leak Checking Today", as
Beattie didn't put it. It seems that we really can't check for leaking
scalars in perl_destruct, because we do our damndest to free them
brute force, rather than by undefining the symbol table and seeing
what sticks around.

p4raw-id: //depot/perl@32942

op.c

diff --git a/op.c b/op.c
index d838325..34eb2e6 100644 (file)
--- a/op.c
+++ b/op.c
@@ -3368,8 +3368,12 @@ Perl_newPMOP(pTHX_ I32 type, I32 flags)
 #ifdef USE_ITHREADS
     if (av_len((AV*) PL_regex_pad[0]) > -1) {
        SV * const repointer = av_pop((AV*)PL_regex_pad[0]);
-       pmop->op_pmoffset = SvIV(repointer);
+       const IV offset = SvIV(repointer);
+       pmop->op_pmoffset = offset;
        sv_setiv(repointer,0);
+       assert(repointer == PL_regex_pad[offset]);
+       /* One reference remains, in PL_regex_pad[offset]  */
+       SvREFCNT_dec(repointer);
     } else {
        SV * const repointer = newSViv(0);
        av_push(PL_regex_padav, repointer);