diff options
-rw-r--r-- | source3/smbd/globals.h | 3 | ||||
-rw-r--r-- | source3/smbd/smb2_server.c | 40 |
2 files changed, 4 insertions, 39 deletions
diff --git a/source3/smbd/globals.h b/source3/smbd/globals.h index 4ca9e712df..94098f0281 100644 --- a/source3/smbd/globals.h +++ b/source3/smbd/globals.h @@ -444,9 +444,6 @@ NTSTATUS smb2srv_open_lookup(struct smbXsrv_connection *conn, struct smbd_smb2_request { struct smbd_smb2_request *prev, *next; - TALLOC_CTX *mem_pool; - struct smbd_smb2_request **parent; - struct smbd_server_connection *sconn; /* the session the request operates on, maybe NULL */ diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index 653a038da5..979a179c1d 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -151,30 +151,9 @@ static void smb2_setup_nbt_length(struct iovec *vector, int count) _smb2_setlen(vector[0].iov_base, len); } -static int smbd_smb2_request_parent_destructor(struct smbd_smb2_request **req) -{ - if (*req) { - (*req)->parent = NULL; - (*req)->mem_pool = NULL; - } - - return 0; -} - -static int smbd_smb2_request_destructor(struct smbd_smb2_request *req) -{ - if (req->parent) { - *req->parent = NULL; - talloc_free(req->mem_pool); - } - - return 0; -} - static struct smbd_smb2_request *smbd_smb2_request_allocate(TALLOC_CTX *mem_ctx) { TALLOC_CTX *mem_pool; - struct smbd_smb2_request **parent; struct smbd_smb2_request *req; #if 0 @@ -187,27 +166,17 @@ static struct smbd_smb2_request *smbd_smb2_request_allocate(TALLOC_CTX *mem_ctx) return NULL; } - parent = talloc(mem_pool, struct smbd_smb2_request *); - if (parent == NULL) { - talloc_free(mem_pool); - return NULL; - } - - req = talloc_zero(parent, struct smbd_smb2_request); + req = talloc_zero(mem_pool, struct smbd_smb2_request); if (req == NULL) { talloc_free(mem_pool); return NULL; } - *parent = req; - req->mem_pool = mem_pool; - req->parent = parent; + talloc_reparent(mem_pool, mem_ctx, req); + TALLOC_FREE(mem_pool); req->last_session_id = UINT64_MAX; req->last_tid = UINT32_MAX; - talloc_set_destructor(parent, smbd_smb2_request_parent_destructor); - talloc_set_destructor(req, smbd_smb2_request_destructor); - return req; } @@ -2800,8 +2769,7 @@ static NTSTATUS smbd_smb2_request_read_recv(struct tevent_req *req, return status; } - talloc_steal(mem_ctx, state->smb2_req->mem_pool); - *_smb2_req = state->smb2_req; + *_smb2_req = talloc_move(mem_ctx, &state->smb2_req); tevent_req_received(req); return NT_STATUS_OK; } |