s4:libcli:smb2: don't allocate the smb2_tree struct earlier than necessary in smb2_co...
authorMichael Adam <obnox@samba.org>
Thu, 2 Feb 2012 12:41:40 +0000 (13:41 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 3 Feb 2012 10:10:30 +0000 (11:10 +0100)
Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>

source4/libcli/smb2/connect.c

index b28013fc945650a6db9cfeb7027e0d9c6a01edc7..a6a5690bf141dfe1bfc42336b6d30ca04dca403f 100644 (file)
@@ -202,11 +202,6 @@ static void smb2_connect_session_done(struct tevent_req *subreq)
                return;
        }
 
-       state->tree = smb2_tree_init(state->session, state, true);
-       if (tevent_req_nomem(state->tree, req)) {
-               return;
-       }
-
        state->tcon.in.reserved = 0;
        state->tcon.in.path     = talloc_asprintf(state, "\\\\%s\\%s",
                                                  state->host, state->share);
@@ -237,6 +232,11 @@ static void smb2_connect_tcon_done(struct smb2_request *smb2req)
                return;
        }
 
+       state->tree = smb2_tree_init(state->session, state, true);
+       if (tevent_req_nomem(state->tree, req)) {
+               return;
+       }
+
        state->tree->tid = state->tcon.out.tid;
 
        tevent_req_done(req);