summaryrefslogtreecommitdiff
path: root/source3/auth/auth.c
diff options
context:
space:
mode:
authorAndrew Bartlett <abartlet@samba.org>2003-11-23 00:23:26 +0000
committerAndrew Bartlett <abartlet@samba.org>2003-11-23 00:23:26 +0000
commit8ade0cf1b6eba966fdb3f2544a83c979195cef75 (patch)
treeb072e66ce609decf86950c44a139c5e455191450 /source3/auth/auth.c
parent13a6b9833e7fdd5e4624ccf844e0f9932d9597c1 (diff)
downloadsamba-8ade0cf1b6eba966fdb3f2544a83c979195cef75.tar.gz
samba-8ade0cf1b6eba966fdb3f2544a83c979195cef75.tar.bz2
samba-8ade0cf1b6eba966fdb3f2544a83c979195cef75.zip
(Merge from 3.0)
Patch by emil@disksites.com <Emil Rasamat> to ensure we always always free() each auth method. (We had relied on the use of talloc() only, despite providing the free() callback) Andrew Bartlett (This used to be commit 58c4963a8389dff4d925548217fabed1c9932abd)
Diffstat (limited to 'source3/auth/auth.c')
-rw-r--r--source3/auth/auth.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/source3/auth/auth.c b/source3/auth/auth.c
index 20dccc6592..1b49699fbc 100644
--- a/source3/auth/auth.c
+++ b/source3/auth/auth.c
@@ -321,9 +321,20 @@ static NTSTATUS check_ntlm_password(const struct auth_context *auth_context,
static void free_auth_context(struct auth_context **auth_context)
{
- if (*auth_context != NULL)
+ auth_methods *auth_method;
+
+ if (*auth_context) {
+ /* Free private data of context's authentication methods */
+ for (auth_method = (*auth_context)->auth_method_list; auth_method; auth_method = auth_method->next) {
+ if (auth_method->free_private_data) {
+ auth_method->free_private_data (&auth_method->private_data);
+ auth_method->private_data = NULL;
+ }
+ }
+
talloc_destroy((*auth_context)->mem_ctx);
- *auth_context = NULL;
+ *auth_context = NULL;
+ }
}
/***************************************************************************