From 40f771e0105a0d13d83d66d99d9412acf6b73978 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Tue, 7 Aug 2012 13:02:14 +0200 Subject: s3:smb2_server: there's no need to copy req->out.vector when we just keep the last request metze --- source3/smbd/smb2_server.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) (limited to 'source3/smbd') diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index fe94d9d658..f439cd7e5f 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -1225,28 +1225,11 @@ NTSTATUS smbd_smb2_request_pending_queue(struct smbd_smb2_request *req, /* Reset the new in size. */ smb2_setup_nbt_length(req->in.vector, req->in.vector_count); - /* Now recreate the out.vectors. */ - outvec = talloc_zero_array(req, struct iovec, 4); - if (!outvec) { - return NT_STATUS_NO_MEMORY; - } - - /* 0 is always boilerplate and must - * be of size 4 for the length field. */ - - outvec[0].iov_base = req->out.nbt_hdr; - outvec[0].iov_len = 4; - SIVAL(req->out.nbt_hdr, 0, 0); - - if (!dup_smb2_vec3(outvec, &outvec[1], &req->out.vector[i])) { - return NT_STATUS_NO_MEMORY; - } - - TALLOC_FREE(req->out.vector); - - req->out.vector = outvec; - - req->out.vector_count = 4; + /* Re-arrange the out.vectors. */ + memmove(&req->out.vector[req->current_idx], + &req->out.vector[i], + sizeof(req->out.vector[0])*SMBD_SMB2_NUM_IOV_PER_REQ); + req->out.vector_count = req->current_idx + SMBD_SMB2_NUM_IOV_PER_REQ; outhdr = SMBD_SMB2_OUT_HDR_PTR(req); flags = (IVAL(outhdr, SMB2_HDR_FLAGS) & ~SMB2_HDR_FLAG_CHAINED); -- cgit