From: Amos Jeffries Date: Tue, 21 Dec 2010 00:42:37 +0000 (-0700) Subject: Author: Alex Rousskov X-Git-Tag: SQUID_3_1_10~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2312b9ed87defdcfec3da710640372efd0a5b67;p=thirdparty%2Fsquid.git Author: Alex Rousskov 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. --- diff --git a/src/adaptation/AccessCheck.cc b/src/adaptation/AccessCheck.cc index abac18d2e0..151374d537 100644 --- a/src/adaptation/AccessCheck.cc +++ b/src/adaptation/AccessCheck.cc @@ -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 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