s4-ntlm: Fix a NULL pointer dereference in error path
authorAndreas Schneider <asn@samba.org>
Wed, 22 Jun 2016 13:53:59 +0000 (15:53 +0200)
committerJeremy Allison <jra@samba.org>
Wed, 22 Jun 2016 21:21:33 +0000 (23:21 +0200)
Found by clang compiler.

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Wed Jun 22 23:21:33 CEST 2016 on sn-devel-144

source4/auth/ntlm/auth_winbind.c

index aed893d236ae1437f4fe379b19c8221f01916087..447c0dee981591342baef0d9bd14944765d27b30 100644 (file)
@@ -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",