diff options
author | Stefan Metzmacher <metze@samba.org> | 2013-11-20 09:56:48 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-03-05 13:59:20 -0800 |
commit | 0ac924b2bb3c256f10cde358b95ea1d8a3833972 (patch) | |
tree | fde0a1a6dd44c538854929781ed8903bfee4bb81 | |
parent | ec498a2414d96567bfed26f35b60ebe1ac40c68b (diff) | |
download | samba-0ac924b2bb3c256f10cde358b95ea1d8a3833972.tar.gz samba-0ac924b2bb3c256f10cde358b95ea1d8a3833972.tar.xz samba-0ac924b2bb3c256f10cde358b95ea1d8a3833972.zip |
s3:smb2_server: avoid a call to data_blob_clear_free() if not needed
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r-- | source3/smbd/smb2_server.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/source3/smbd/smb2_server.c b/source3/smbd/smb2_server.c index c98766247d..dea3915d96 100644 --- a/source3/smbd/smb2_server.c +++ b/source3/smbd/smb2_server.c @@ -253,8 +253,12 @@ static void smb2_setup_nbt_length(struct iovec *vector, int count) static int smbd_smb2_request_destructor(struct smbd_smb2_request *req) { - data_blob_clear_free(&req->first_key); - data_blob_clear_free(&req->last_key); + if (req->first_key.length > 0) { + data_blob_clear_free(&req->first_key); + } + if (req->last_key.length > 0) { + data_blob_clear_free(&req->last_key); + } return 0; } @@ -1343,7 +1347,9 @@ NTSTATUS smbd_smb2_request_pending_queue(struct smbd_smb2_request *req, if (!NT_STATUS_IS_OK(status)) { return status; } - data_blob_clear_free(&req->first_key); + if (req->first_key.length > 0) { + data_blob_clear_free(&req->first_key); + } req->current_idx = 1; @@ -1374,7 +1380,9 @@ NTSTATUS smbd_smb2_request_pending_queue(struct smbd_smb2_request *req, SIVAL(outhdr, SMB2_HDR_FLAGS, flags); } } - data_blob_clear_free(&req->last_key); + if (req->last_key.length > 0) { + data_blob_clear_free(&req->last_key); + } defer_endtime = timeval_current_ofs_usec(defer_time); req->async_te = tevent_add_timer(req->sconn->ev_ctx, @@ -2364,7 +2372,9 @@ static NTSTATUS smbd_smb2_request_reply(struct smbd_smb2_request *req) return status; } } - data_blob_clear_free(&req->last_key); + if (req->last_key.length > 0) { + data_blob_clear_free(&req->last_key); + } req->current_idx += SMBD_SMB2_NUM_IOV_PER_REQ; @@ -2438,7 +2448,9 @@ static NTSTATUS smbd_smb2_request_reply(struct smbd_smb2_request *req) return status; } } - data_blob_clear_free(&req->first_key); + if (req->first_key.length > 0) { + data_blob_clear_free(&req->first_key); + } /* I am a sick, sick man... :-). Sendfile hack ... JRA. */ if (req->out.vector_count < (2*SMBD_SMB2_NUM_IOV_PER_REQ) && |