]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
fixed cbdata "cookie" assertion. peer_digest was unlocking peer, but did
authorwessels <>
Fri, 13 Apr 2007 05:30:09 +0000 (05:30 +0000)
committerwessels <>
Fri, 13 Apr 2007 05:30:09 +0000 (05:30 +0000)
not lock it.  The extra unlock caused it to be freed prematurely.

src/peer_digest.cc

index c31ad5fe18d013affbaaf8a3280af1025a1481ae..ba2d46db90526a7a3e0ba6336fe4e21577f52a97 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: peer_digest.cc,v 1.118 2006/08/21 00:50:41 robertc Exp $
+ * $Id: peer_digest.cc,v 1.119 2007/04/12 23:30:09 wessels Exp $
  *
  * DEBUG: section 72    Peer Digest Routines
  * AUTHOR: Alex Rousskov
@@ -92,7 +92,12 @@ peerDigestInit(PeerDigest * pd, peer * p)
     assert(pd && p);
 
     memset(pd, 0, sizeof(*pd));
-    pd->peer = p;
+    /*
+     * DPW 2007-04-12
+     * Lock on to the peer here.  The corresponding cbdataReferenceDone()
+     * is in peerDigestDestroy().
+     */
+    pd->peer = cbdataReference(p);
     /* if peer disappears, we will know it's name */
     pd->host = p->host;
 
@@ -149,8 +154,12 @@ peerDigestDestroy(PeerDigest * pd)
     assert(pd);
     void * peerTmp = pd->peer;
 
-    /* inform peer (if any) that we are gone */
-
+    /*
+     * DPW 2007-04-12
+     * We locked the peer in peerDigestInit(), this is
+     * where we unlock it.  If the peer is still valid,
+     * tell it that the digest is gone.
+     */
     if (cbdataReferenceValidDone(peerTmp, &p))
         peerNoteDigestGone((peer *)p);