diff options
author | Volker Lendecke <vl@samba.org> | 2010-04-25 10:25:55 +0200 |
---|---|---|
committer | Volker Lendecke <vl@samba.org> | 2010-04-25 10:55:19 +0200 |
commit | 13cdaf9417ab08425d9b7e244a6830d34147b889 (patch) | |
tree | 070a820f21bb4d61e69126731c8fd1cd66c4b1e2 | |
parent | d61b07253b04a17226cfd92ef8bf785c93263ce3 (diff) | |
download | samba-13cdaf9417ab08425d9b7e244a6830d34147b889.tar.gz samba-13cdaf9417ab08425d9b7e244a6830d34147b889.tar.bz2 samba-13cdaf9417ab08425d9b7e244a6830d34147b889.zip |
s3: Make "struct trustdom_state" its own talloc context
-rw-r--r-- | source3/winbindd/winbindd_util.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/source3/winbindd/winbindd_util.c b/source3/winbindd/winbindd_util.c index 0209a31803..3f2920ae7a 100644 --- a/source3/winbindd/winbindd_util.c +++ b/source3/winbindd/winbindd_util.c @@ -237,7 +237,6 @@ bool domain_is_forest_root(const struct winbindd_domain *domain) ********************************************************************/ struct trustdom_state { - TALLOC_CTX *mem_ctx; bool primary; bool forest_root; struct winbindd_response *response; @@ -249,28 +248,24 @@ static void rescan_forest_trusts( void ); static void add_trusted_domains( struct winbindd_domain *domain ) { - TALLOC_CTX *mem_ctx; struct winbindd_request *request; struct winbindd_response *response; struct trustdom_state *state; - mem_ctx = talloc_init("add_trusted_domains"); - if (mem_ctx == NULL) { + state = TALLOC_ZERO_P(NULL, struct trustdom_state); + if (state == NULL) { DEBUG(0, ("talloc_init failed\n")); return; } - request = TALLOC_ZERO_P(mem_ctx, struct winbindd_request); - response = TALLOC_P(mem_ctx, struct winbindd_response); - state = TALLOC_P(mem_ctx, struct trustdom_state); + request = TALLOC_ZERO_P(state, struct winbindd_request); + response = TALLOC_P(state, struct winbindd_response); - if ((request == NULL) || (response == NULL) || (state == NULL)) { + if ((request == NULL) || (response == NULL)) { DEBUG(0, ("talloc failed\n")); - talloc_destroy(mem_ctx); + TALLOC_FREE(state); return; } - - state->mem_ctx = mem_ctx; state->response = response; /* Flags used to know how to continue the forest trust search */ @@ -281,7 +276,7 @@ static void add_trusted_domains( struct winbindd_domain *domain ) request->length = sizeof(*request); request->cmd = WINBINDD_LIST_TRUSTDOM; - async_domain_request(mem_ctx, domain, request, response, + async_domain_request(state, domain, request, response, trustdom_recv, state); } @@ -294,7 +289,7 @@ static void trustdom_recv(void *private_data, bool success) if ((!success) || (response->result != WINBINDD_OK)) { DEBUG(1, ("Could not receive trustdoms\n")); - talloc_destroy(state->mem_ctx); + TALLOC_FREE(state); return; } @@ -384,7 +379,7 @@ static void trustdom_recv(void *private_data, bool success) rescan_forest_trusts(); } - talloc_destroy(state->mem_ctx); + TALLOC_FREE(state); return; } |