diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2012-02-09 20:00:22 +0100 |
---|---|---|
committer | Stephen Gallagher <sgallagh@redhat.com> | 2012-02-13 11:46:55 -0500 |
commit | 2cba1c86f48db866fc72738a32eecbbdcdf3dbdb (patch) | |
tree | 2ec2107d932d6451703a29d91783f443353460bf /src/responder/common | |
parent | 2a283b7f55508f05e58e61490208b8464731dc40 (diff) | |
download | sssd-2cba1c86f48db866fc72738a32eecbbdcdf3dbdb.tar.gz sssd-2cba1c86f48db866fc72738a32eecbbdcdf3dbdb.tar.xz sssd-2cba1c86f48db866fc72738a32eecbbdcdf3dbdb.zip |
Remove setent structure when callback is called
Diffstat (limited to 'src/responder/common')
-rw-r--r-- | src/responder/common/responder.h | 4 | ||||
-rw-r--r-- | src/responder/common/responder_cmd.c | 18 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/responder/common/responder.h b/src/responder/common/responder.h index 7ec2ee3dc..48678ff92 100644 --- a/src/responder/common/responder.h +++ b/src/responder/common/responder.h @@ -168,8 +168,8 @@ errno_t setent_add_ref(TALLOC_CTX *memctx, void *pvt, struct setent_req_list **list, struct tevent_req *req); -void setent_notify(struct setent_req_list *list, errno_t err); -void setent_notify_done(struct setent_req_list *list); +void setent_notify(struct setent_req_list **list, errno_t err); +void setent_notify_done(struct setent_req_list **list); errno_t sss_cmd_check_cache(struct ldb_message *msg, diff --git a/src/responder/common/responder_cmd.c b/src/responder/common/responder_cmd.c index f36ea14af..16f38eafd 100644 --- a/src/responder/common/responder_cmd.c +++ b/src/responder/common/responder_cmd.c @@ -160,8 +160,8 @@ int sss_cmd_execute(struct cli_ctx *cctx, struct sss_cmd_table *sss_cmds) struct setent_req_list { struct setent_req_list *prev; struct setent_req_list *next; - /* Need to point to the head of the list from a talloc destructor */ - struct setent_req_list *head; + /* Need to modify the list from a talloc destructor */ + struct setent_req_list **head; void *pvt; @@ -178,7 +178,7 @@ int setent_remove_ref(TALLOC_CTX *ctx) { struct setent_req_list *entry = talloc_get_type(ctx, struct setent_req_list); - DLIST_REMOVE(entry->head, entry); + DLIST_REMOVE(*(entry->head), entry); return 0; } @@ -197,18 +197,18 @@ errno_t setent_add_ref(TALLOC_CTX *memctx, entry->req = req; entry->pvt = pvt; DLIST_ADD_END(*list, entry, struct setent_req_list *); - entry->head = *list; + entry->head = list; talloc_set_destructor((TALLOC_CTX *)entry, setent_remove_ref); return EOK; } -void setent_notify(struct setent_req_list *list, errno_t err) +void setent_notify(struct setent_req_list **list, errno_t err) { struct setent_req_list *reql; /* Notify the waiting clients */ - while ((reql = list)) { + while ((reql = *list) != NULL) { /* Each tevent_req_done() call will free * the request, removing it from the list. */ @@ -218,7 +218,7 @@ void setent_notify(struct setent_req_list *list, errno_t err) tevent_req_error(reql->req, err); } - if (reql == list) { + if (reql == *list) { /* The consumer failed to free the * request. Log a bug and continue. */ @@ -226,12 +226,12 @@ void setent_notify(struct setent_req_list *list, errno_t err) ("BUG: a callback did not free its request. " "May leak memory\n")); /* Skip to the next since a memory leak is non-fatal */ - list = list->next; + *list = (*list)->next; } } } -void setent_notify_done(struct setent_req_list *list) +void setent_notify_done(struct setent_req_list **list) { return setent_notify(list, EOK); } |