]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Alex Rousskov <rousskov@measurement-factory.com>
authorwessels <>
Tue, 8 May 2007 03:51:21 +0000 (03:51 +0000)
committerwessels <>
Tue, 8 May 2007 03:51:21 +0000 (03:51 +0000)
Bug #1752: cbdata problems with storeRegisterAbort()

Bug found by valgrind.  There is no cbdata reference held by
storeRegisterAbort() and abort.data should be a cbdata reference
pointer.

src/store.cc

index eecec7da32ebecaea9a2685f114714e9e86606fc..56b98209886de8eb4c0debbfafeb4cd8047f0a4b 100644 (file)
@@ -1,6 +1,6 @@
 
 /*
- * $Id: store.cc,v 1.611 2007/04/30 16:56:09 wessels Exp $
+ * $Id: store.cc,v 1.612 2007/05/07 21:51:21 wessels Exp $
  *
  * DEBUG: section 20    Storage Manager
  * AUTHOR: Harvest Derived
@@ -1119,14 +1119,19 @@ StoreEntry::abort()
 
     /* Notify the server side */
 
+    /*
+     * DPW 2007-05-07
+     * Should we check abort.data for validity?
+     */
     if (mem_obj->abort.callback) {
+       if (!cbdataReferenceValid(mem_obj->abort.data))
+           debugs(20,1,HERE << "queueing event when abort.data is not valid");
         eventAdd("mem_obj->abort.callback",
                  mem_obj->abort.callback,
                  mem_obj->abort.data,
                  0.0,
-                 0);
-        mem_obj->abort.callback = NULL;
-        mem_obj->abort.data = NULL;
+                 true);
+       unregisterAbort();
     }
 
     /* XXX Should we reverse these two, so that there is no
@@ -1546,14 +1551,17 @@ StoreEntry::registerAbort(STABH * cb, void *data)
     assert(mem_obj);
     assert(mem_obj->abort.callback == NULL);
     mem_obj->abort.callback = cb;
-    mem_obj->abort.data = data;
+    mem_obj->abort.data = cbdataReference(data);
 }
 
 void
 StoreEntry::unregisterAbort()
 {
     assert(mem_obj);
-    mem_obj->abort.callback = NULL;
+    if (mem_obj->abort.callback) {
+       mem_obj->abort.callback = NULL;
+       cbdataReferenceDone(mem_obj->abort.data);
+    }
 }
 
 void