r3542: Re-indent, and fix a use-after-free by doing the talloc_destroy just a
authorAndrew Bartlett <abartlet@samba.org>
Fri, 5 Nov 2004 06:56:39 +0000 (06:56 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 18:05:30 +0000 (13:05 -0500)
little later.

Andrew Bartlett
(This used to be commit b7c2a4fc34ef09b177508dcf475055523b84587c)

source4/librpc/rpc/dcerpc_util.c

index 3e460af8e787bbe74e1f170e20f8bbbf37c72fef..a717bdbc915adffc1a9a1b109b8f4ab33a60c244 100644 (file)
@@ -810,10 +810,8 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(struct dcerpc_pipe **p,
                smbcli_tdis(cli);
                smbcli_shutdown(cli);
                talloc_destroy(mem_ctx);
-        return status;
-    }  
-
-       talloc_destroy(mem_ctx);
+               return status;
+       }
        
        /* this ensures that the reference count is decremented so
           a pipe close will really close the link */
@@ -824,6 +822,8 @@ static NTSTATUS dcerpc_pipe_connect_ncacn_np(struct dcerpc_pipe **p,
        /* remember the binding string for possible secondary connections */
        (*p)->binding_string = dcerpc_binding_string((*p), binding);
 
+       talloc_destroy(mem_ctx);
+
        if (username && username[0] && (binding->flags & DCERPC_SCHANNEL_ANY)) {
                status = dcerpc_bind_auth_schannel(*p, pipe_uuid, pipe_version, 
                                                   domain, username, password);