From f2312b9ed87defdcfec3da710640372efd0a5b67 Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Mon, 20 Dec 2010 17:42:37 -0700 Subject: [PATCH] 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. --- src/adaptation/AccessCheck.cc | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 -- 2.47.2