From a737efe2bd45fffe82d1815789c63172e01ed1d7 Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Wed, 22 Jun 2016 15:53:59 +0200 Subject: [PATCH] s4-ntlm: Fix a NULL pointer dereference in error path Found by clang compiler. Signed-off-by: Andreas Schneider Reviewed-by: Jeremy Allison Autobuild-User(master): Jeremy Allison Autobuild-Date(master): Wed Jun 22 23:21:33 CEST 2016 on sn-devel-144 --- source4/auth/ntlm/auth_winbind.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source4/auth/ntlm/auth_winbind.c b/source4/auth/ntlm/auth_winbind.c index aed893d236a..447c0dee981 100644 --- a/source4/auth/ntlm/auth_winbind.c +++ b/source4/auth/ntlm/auth_winbind.c @@ -216,9 +216,11 @@ static NTSTATUS winbind_check_password_wbclient(struct auth_method_context *ctx, if (err) { DEBUG(1, ("error was %s (0x%08x)\nerror message was '%s'\n", err->nt_string, err->nt_status, err->display_string)); + nt_status = NT_STATUS(err->nt_status); + wbcFreeMemory(err); + } else { + nt_status = NT_STATUS_LOGON_FAILURE; } - nt_status = NT_STATUS(err->nt_status); - wbcFreeMemory(err); NT_STATUS_NOT_OK_RETURN(nt_status); } else if (!WBC_ERROR_IS_OK(wbc_status)) { DEBUG(1, ("wbcAuthenticateUserEx: failed with %u - %s\n",