[SSSD] [PATCH] Free internal account request when finished
Jakub Hrozek
jhrozek at redhat.com
Fri Jan 20 15:20:27 UTC 2012
I noticed that we never marked the internal account request as done so
the internal _recv function was never called and we would never free the
internal tevent_req structure. That means the responder_ctx would grow
in size..
The attached patch marks the internal request as done when all the
callbacks are handled. The outside account_done function is then only
called for the request that triggered DP lookup and the internal request
is freed.
-------------- next part --------------
From e3d0181e39057eb200ffb8a9e9f306ac5b6c2f11 Mon Sep 17 00:00:00 2001
From: Jakub Hrozek <jhrozek at redhat.com>
Date: Fri, 20 Jan 2012 10:48:16 +0100
Subject: [PATCH] Free internal account request when finished
---
src/responder/common/responder_dp.c | 66 ++++++++++++++---------------------
1 files changed, 26 insertions(+), 40 deletions(-)
diff --git a/src/responder/common/responder_dp.c b/src/responder/common/responder_dp.c
index 6bc086c2a745802ee961d71f2f3162a2ae3cc1b7..8f48ccf1181fea0ba0129ccb6e4f916825093e0b 100644
--- a/src/responder/common/responder_dp.c
+++ b/src/responder/common/responder_dp.c
@@ -226,11 +226,10 @@ static void
sss_dp_get_account_done(struct tevent_req *subreq);
static errno_t
-sss_dp_get_account_int_recv(TALLOC_CTX *mem_ctx,
- struct tevent_req *req,
- dbus_uint16_t *err_maj,
- dbus_uint32_t *err_min,
- char **err_msg);
+sss_dp_get_account_int_recv(struct tevent_req *req,
+ dbus_uint16_t *err_maj,
+ dbus_uint32_t *err_min,
+ char **err_msg);
/* Send a request to the data provider
@@ -422,20 +421,18 @@ static void
sss_dp_get_account_done(struct tevent_req *subreq)
{
errno_t ret;
- struct tevent_req *req = tevent_req_callback_data(subreq,
- struct tevent_req);
- struct dp_get_account_state *state =
- tevent_req_data(req, struct dp_get_account_state);
+ dbus_uint16_t err_maj;
+ dbus_uint32_t err_min;
+ char *err_msg;
- ret = sss_dp_get_account_int_recv(state, req,
- &state->err_maj,
- &state->err_min,
- &state->err_msg);
+ ret = sss_dp_get_account_int_recv(subreq, &err_maj,
+ &err_min, &err_msg);
if (ret != EOK) {
- tevent_req_done(req);
- } else {
- tevent_req_error(req, ret);
+ DEBUG(SSSDBG_OP_FAILURE,
+ ("DP request failed maj: [%d] min: [%d] err: [%s]\n",
+ err_maj, err_min, err_msg));
}
+ talloc_free(subreq);
}
errno_t
@@ -672,33 +669,22 @@ static void sss_dp_get_account_int_done(DBusPendingCall *pending, void *ptr)
* This will clean up the hash table entry as well
*/
talloc_zfree(sdp_req);
+
+ /* We're sure there are no callbacks now, the sdp_req
+ * destructor cleaned them all. */
+ if (ret == EOK) {
+ tevent_req_done(req);
+ } else {
+ tevent_req_error(req, ret);
+ }
}
static errno_t
-sss_dp_get_account_int_recv(TALLOC_CTX *mem_ctx,
- struct tevent_req *req,
- dbus_uint16_t *err_maj,
- dbus_uint32_t *err_min,
- char **err_msg)
+sss_dp_get_account_int_recv(struct tevent_req *req,
+ dbus_uint16_t *err_maj,
+ dbus_uint32_t *err_min,
+ char **err_msg)
{
- struct dp_get_account_int_state *state =
- tevent_req_data(req, struct dp_get_account_int_state);
-
- enum tevent_req_state TRROEstate;
- uint64_t TRROEerr;
-
- *err_maj = state->sdp_req->err_maj;
- *err_min = state->sdp_req->err_min;
- *err_msg = talloc_steal(mem_ctx, state->sdp_req->err_msg);
-
- if (tevent_req_is_error(req, &TRROEstate, &TRROEerr)) {
- if (TRROEstate == TEVENT_REQ_USER_ERROR) {
- *err_maj = DP_ERR_FATAL;
- *err_min = TRROEerr;
- } else {
- return EIO;
- }
- }
-
+ TEVENT_REQ_RETURN_ON_ERROR(req);
return EOK;
}
--
1.7.7.5
More information about the sssd-devel
mailing list