[tpop3d-discuss] auth-perl onlogin handler

Chris Lightfoot chris at ex-parrot.com
Tue, 26 Aug 2003 00:01:10 +0100


On Mon, Aug 25, 2003 at 05:11:48PM -0400, Kevin Bonner wrote:

> After seeing the ease of supporting bulletins with auth-perl, I got curious 
> and started playing around.  The code in my script works (at the moment it 
> just updates a database field), but I keep seeing the following error when a 
> successful connection is made:
> 
> Attempt to free unreferenced scalar.

Yes, I just discovered this too.

The auth-perl code hasn't changed, so I think that this is
a new warning which perl 5.6.x emits. The perldiag(3)
blurb is--

    (W internal) Perl went to decrement the reference
    count of a scalar to see if it would go to 0, and
    discovered that it had already gone to 0 earlier, and
    should have been freed, and in fact, probably was
    freed.  This could indicate that SvREFCNT_dec() was
    called too many times, or that SvREFCNT_inc() was
    called too few times, or that the SV was mortalized
    when it shouldn't have been, or that memory has been
    corrupted.

I've made this change:

diff -u -r1.24 -r1.25
--- auth_perl.c 25 Jun 2002 20:28:00 -0000      1.24
+++ auth_perl.c 25 Aug 2003 17:51:25 -0000      1.25
@@ -218,7 +218,7 @@
             STRLEN len2;
             stringmap_insert(s, key, item_ptr(xstrdup(SvPV(val, len2))));
         }
-        SvREFCNT_dec(hashref_out);
+/*        SvREFCNT_dec(hashref_out);*/  /* `Attempt to free unreferenced scalar' */
     }
 
     SvREFCNT_dec(hashref_in);

in CVS, but I'm not absolutely sure it's right. It
eliminates the warning, anyway....

-- 
Every new beginning comes from some other beginning's end