From: Stefan Metzmacher Date: Tue, 7 Aug 2012 11:02:14 +0000 (+0200) Subject: s3:smb2_server: there's no need to copy req->out.vector when we just keep the last... X-Git-Tag: ldb-1.1.10~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=40f771e0105a0d13d83d66d99d9412acf6b73978;p=thirdparty%2Fsamba.git s3:smb2_server: there's no need to copy req->out.vector when we just keep the last request metze --- diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index fe94d9d658a..f439cd7e5f8 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);