From f82a03b2c19e702d70ff92d3f6d1c129dcf84c86 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 24 Jan 2005 02:19:57 +0000 Subject: r4955: fixed a couple of minor memory leaks in the auth_sam code (This used to be commit 2eba223bda43a81e7aa795e58e551b0b556ddcfa) --- source4/auth/auth_sam.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'source4') diff --git a/source4/auth/auth_sam.c b/source4/auth/auth_sam.c index 195cdeb06d..44a8b19cae 100644 --- a/source4/auth/auth_sam.c +++ b/source4/auth/auth_sam.c @@ -357,12 +357,14 @@ static NTSTATUS authsam_make_server_info(TALLOC_CTX *mem_ctx, void *sam_ctx, const char *str; int i; uint_t rid; + TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx); group_ret = samdb_search(sam_ctx, - mem_ctx, NULL, &group_msgs, group_attrs, + tmp_ctx, NULL, &group_msgs, group_attrs, "(&(member=%s)(sAMAccountType=*))", msgs[0]->dn); if (group_ret == -1) { + talloc_free(tmp_ctx); return NT_STATUS_INTERNAL_DB_CORRUPTION; } @@ -381,6 +383,8 @@ static NTSTATUS authsam_make_server_info(TALLOC_CTX *mem_ctx, void *sam_ctx, NT_STATUS_HAVE_NO_MEMORY(groupSIDs[i]); } + talloc_free(tmp_ctx); + str = ldb_msg_find_string(msgs[0], "objectSid", NULL); account_sid = dom_sid_parse_talloc(server_info, str); NT_STATUS_HAVE_NO_MEMORY(account_sid); @@ -481,6 +485,9 @@ NTSTATUS sam_get_server_info(TALLOC_CTX *mem_ctx, const char *account_name, cons server_info); NT_STATUS_NOT_OK_RETURN(nt_status); + talloc_free(msgs); + talloc_free(domain_msgs); + return NT_STATUS_OK; } @@ -519,6 +526,9 @@ static NTSTATUS authsam_check_password_internals(struct auth_method_context *ctx server_info); NT_STATUS_NOT_OK_RETURN(nt_status); + talloc_free(msgs); + talloc_free(domain_msgs); + return NT_STATUS_OK; } -- cgit