]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Author: Alex Rousskov <rousskov@measurement-factory.com>
authorAmos Jeffries <squid3@treenet.co.nz>
Tue, 21 Dec 2010 00:42:37 +0000 (17:42 -0700)
committerAmos Jeffries <squid3@treenet.co.nz>
Tue, 21 Dec 2010 00:42:37 +0000 (17:42 -0700)
Prevent memory leaks when Adaptation::AccessCheck callback ends the job.

The AccessCheckCallbackWrapper is used in nonBlockingCheck() and is called
from the ACL code, using legacy function-based API.  If the job ends during
the callback processing, there are no AsyncCall wrappers to destroy the job
object. We now convert legacy to async call to enable proper wrapping and job
destruction.

These kind of job leaks are invisible to valgrind, but that is another bug.

src/adaptation/AccessCheck.cc

index abac18d2e04d54fd914b5fbe41b9d1ba9aee7c26..151374d5378e23a9c82a81f063ad320c4c08fe89 100644 (file)
@@ -124,7 +124,15 @@ Adaptation::AccessCheck::AccessCheckCallbackWrapper(int answer, void *data)
      * we should be kicking off an authentication before continuing
      * with this request. see bug 2400 for details.
      */
-    ac->noteAnswer(answer==ACCESS_ALLOWED);
+
+    // convert to async call to get async call protections and features
+    typedef UnaryMemFunT<AccessCheck, int> MyDialer;
+    AsyncCall::Pointer call =
+        asyncCall(93,7, "Adaptation::AccessCheck::noteAnswer",
+                  MyDialer(ac, &Adaptation::AccessCheck::noteAnswer,
+                           answer==ACCESS_ALLOWED));
+    ScheduleCallHere(call);
+
 }
 
 /// process the results of the ACL check