summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-08-19 12:28:24 +0000
committerMichael Adam <obnox@samba.org>2013-08-20 14:35:21 +0200
commit534af203e3e32789b673e6e029b3fb3fd5d40646 (patch)
tree63dd1d82c5fe8b671f359e429fd8bce3676b6728 /source3
parente7dab403c0ca6f64d0ffe5a61898cd642a16b078 (diff)
downloadsamba-534af203e3e32789b673e6e029b3fb3fd5d40646.tar.gz
samba-534af203e3e32789b673e6e029b3fb3fd5d40646.tar.bz2
samba-534af203e3e32789b673e6e029b3fb3fd5d40646.zip
smbd: Simplify new_break_message_smb1
There's no point in allocating a fixed length array that we throw away immediately after use. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org> Autobuild-User(master): Michael Adam <obnox@samba.org> Autobuild-Date(master): Tue Aug 20 14:35:21 CEST 2013 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/oplock.c25
1 files changed, 7 insertions, 18 deletions
diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c
index fbdd6c8796..21792bdee4 100644
--- a/source3/smbd/oplock.c
+++ b/source3/smbd/oplock.c
@@ -223,16 +223,11 @@ bool should_notify_deferred_opens(struct smbd_server_connection *sconn)
Set up an oplock break message.
****************************************************************************/
-static char *new_break_message_smb1(TALLOC_CTX *mem_ctx,
- files_struct *fsp, int cmd)
-{
- char *result = talloc_array(mem_ctx, char, smb_size + 8*2 + 0);
-
- if (result == NULL) {
- DEBUG(0, ("talloc failed\n"));
- return NULL;
- }
+#define SMB1_BREAK_MESSAGE_LENGTH (smb_size + 8*2)
+static void new_break_message_smb1(files_struct *fsp, int cmd,
+ char result[SMB1_BREAK_MESSAGE_LENGTH])
+{
memset(result,'\0',smb_size);
srv_set_message(result,8,0,true);
SCVAL(result,smb_com,SMBlockingX);
@@ -244,7 +239,6 @@ static char *new_break_message_smb1(TALLOC_CTX *mem_ctx,
SSVAL(result,smb_vwv2,fsp->fnum);
SCVAL(result,smb_vwv3,LOCKING_ANDX_OPLOCK_RELEASE);
SCVAL(result,smb_vwv3+1,cmd);
- return result;
}
/****************************************************************************
@@ -369,12 +363,9 @@ static void add_oplock_timeout_handler(files_struct *fsp)
static void send_break_message_smb1(files_struct *fsp, int level)
{
- char *break_msg = new_break_message_smb1(talloc_tos(),
- fsp,
- level);
- if (break_msg == NULL) {
- exit_server("Could not talloc break_msg\n");
- }
+ char break_msg[SMB1_BREAK_MESSAGE_LENGTH];
+
+ new_break_message_smb1(fsp, level, break_msg);
show_msg(break_msg);
if (!srv_send_smb(fsp->conn->sconn,
@@ -384,8 +375,6 @@ static void send_break_message_smb1(files_struct *fsp, int level)
exit_server_cleanly("send_break_message_smb1: "
"srv_send_smb failed.");
}
-
- TALLOC_FREE(break_msg);
}
static void break_level2_to_none_async(files_struct *fsp)