s3:winbind: Simplify open_cached_internal_pipe_conn()
authorSamuel Cabrero <scabrero@samba.org>
Wed, 13 Apr 2022 09:15:35 +0000 (11:15 +0200)
committerAndreas Schneider <asn@cryptomilk.org>
Wed, 13 Apr 2022 12:59:30 +0000 (12:59 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15046

Signed-off-by: Samuel Cabrero <scabrero@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
source3/winbindd/winbindd_samr.c

index d5c4e8e1f4f4833d3f4a6bd36646aba3aaccce60..ebf9c24b9e4d7315b9c1a05c4d0b30f9426bc9d4 100644 (file)
@@ -150,9 +150,10 @@ static NTSTATUS open_cached_internal_pipe_conn(
        struct rpc_pipe_client **lsa_pipe,
        struct policy_handle *lsa_hnd)
 {
-       struct winbind_internal_pipes *internal_pipes = NULL;
+       struct winbind_internal_pipes *internal_pipes =
+               domain->backend_data.samr_pipes;
 
-       if (domain->backend_data.samr_pipes == NULL) {
+       if (internal_pipes == NULL) {
                TALLOC_CTX *frame = talloc_stackframe();
                NTSTATUS status;
 
@@ -190,14 +191,11 @@ static NTSTATUS open_cached_internal_pipe_conn(
                }
 
                domain->backend_data.samr_pipes =
-                       talloc_move(domain, &internal_pipes);
+                       talloc_steal(domain, internal_pipes);
 
                TALLOC_FREE(frame);
-
        }
 
-       internal_pipes = domain->backend_data.samr_pipes;
-
        if (samr_domain_hnd) {
                *samr_domain_hnd = internal_pipes->samr_domain_hnd;
        }