diff --git a/dlls/rpcrt4/rpc_binding.c b/dlls/rpcrt4/rpc_binding.c index 19272afb56f..d86add33ee1 100644 --- a/dlls/rpcrt4/rpc_binding.c +++ b/dlls/rpcrt4/rpc_binding.c @@ -982,9 +982,9 @@ static RPC_STATUS RpcAuthInfo_Create(ULONG AuthnLevel, ULONG AuthnSvc, AuthInfo->nt_identity->Password = RPCRT4_strndupAtoW((const char *)nt_identity->Password, nt_identity->PasswordLength); AuthInfo->nt_identity->PasswordLength = nt_identity->PasswordLength; - if (!AuthInfo->nt_identity->User || - !AuthInfo->nt_identity->Domain || - !AuthInfo->nt_identity->Password) + if ((nt_identity->User && !AuthInfo->nt_identity->User) || + (nt_identity->Domain && !AuthInfo->nt_identity->Domain) || + (nt_identity->Password && !AuthInfo->nt_identity->Password)) { HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->User); HeapFree(GetProcessHeap(), 0, AuthInfo->nt_identity->Domain); @@ -1572,7 +1572,7 @@ RpcBindingSetAuthInfoExW( RPC_BINDING_HANDLE Binding, RPC_WSTR ServerPrincName, if (r == RPC_S_OK) { new_auth_info->server_principal_name = RPCRT4_strdupW(ServerPrincName); - if (new_auth_info->server_principal_name) + if (!ServerPrincName || new_auth_info->server_principal_name) { if (bind->AuthInfo) RpcAuthInfo_Release(bind->AuthInfo); bind->AuthInfo = new_auth_info;