From 925e96029e8854a1a3ad59fb4844c02b5aa77527 Mon Sep 17 00:00:00 2001 From: Matthias Dieter Wallnöfer Date: Fri, 16 Oct 2009 13:48:17 +0200 Subject: s4:auth_sam: Restructure tail in "authsam_get_server_info_principal" and fix a memory leak --- source4/auth/ntlm/auth_sam.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'source4') diff --git a/source4/auth/ntlm/auth_sam.c b/source4/auth/ntlm/auth_sam.c index a64c56d920..58a21d2d22 100644 --- a/source4/auth/ntlm/auth_sam.c +++ b/source4/auth/ntlm/auth_sam.c @@ -332,6 +332,7 @@ NTSTATUS authsam_get_server_info_principal(TALLOC_CTX *mem_ctx, nt_status = sam_get_results_principal(sam_ctx, tmp_ctx, principal, user_attrs, &domain_dn, &msg); if (!NT_STATUS_IS_OK(nt_status)) { + talloc_free(tmp_ctx); return nt_status; } @@ -342,11 +343,15 @@ NTSTATUS authsam_get_server_info_principal(TALLOC_CTX *mem_ctx, msg, user_sess_key, lm_sess_key, server_info); - if (NT_STATUS_IS_OK(nt_status)) { - talloc_steal(mem_ctx, *server_info); + if (!NT_STATUS_IS_OK(nt_status)) { + talloc_free(tmp_ctx); + return nt_status; } + + talloc_steal(mem_ctx, *server_info); talloc_free(tmp_ctx); - return nt_status; + + return NT_STATUS_OK; } static const struct auth_operations sam_ignoredomain_ops = { -- cgit