]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Prevent memory leaks when Adaptation::AccessCheck callback ends the job.
authorAlex Rousskov <rousskov@measurement-factory.com>
Sun, 28 Nov 2010 15:29:51 +0000 (08:29 -0700)
committerAlex Rousskov <rousskov@measurement-factory.com>
Sun, 28 Nov 2010 15:29:51 +0000 (08:29 -0700)
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 c399636ab5b35c0cbc99b886cedf25a817a368c4..1f880ba52a6155190647e2bf1ac7e78f168fe343 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