diff --git a/source3/smbd/open.c b/source3/smbd/open.c index 16950eb4144..9008b82d763 100644 --- a/source3/smbd/open.c +++ b/source3/smbd/open.c @@ -1995,7 +1995,8 @@ NTSTATUS send_break_message(struct messaging_context *msg_ctx, .break_to = break_to, }; enum ndr_err_code ndr_err; - DATA_BLOB blob; + uint8_t msgbuf[33]; + DATA_BLOB blob = {.data = msgbuf, .length = sizeof(msgbuf)}; NTSTATUS status; if (DEBUGLVL(10)) { @@ -2005,9 +2006,8 @@ NTSTATUS send_break_message(struct messaging_context *msg_ctx, NDR_PRINT_DEBUG(oplock_break_message, &msg); } - ndr_err = ndr_push_struct_blob( + ndr_err = ndr_push_struct_into_fixed_blob( &blob, - talloc_tos(), &msg, (ndr_push_flags_fn_t)ndr_push_oplock_break_message); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -2016,9 +2016,10 @@ NTSTATUS send_break_message(struct messaging_context *msg_ctx, return ndr_map_error2ntstatus(ndr_err); } - status = messaging_send( - msg_ctx, exclusive->pid, MSG_SMB_BREAK_REQUEST, &blob); - TALLOC_FREE(blob.data); + status = messaging_send(msg_ctx, + exclusive->pid, + MSG_SMB_BREAK_REQUEST, + &blob); if (!NT_STATUS_IS_OK(status)) { DEBUG(3, ("Could not send oplock break message: %s\n", nt_errstr(status))); diff --git a/source3/smbd/smb2_oplock.c b/source3/smbd/smb2_oplock.c index 9d61bc2ff63..eec805f1b46 100644 --- a/source3/smbd/smb2_oplock.c +++ b/source3/smbd/smb2_oplock.c @@ -829,7 +829,7 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx, struct server_id src, DATA_BLOB *data) { - struct oplock_break_message *msg = NULL; + struct oplock_break_message msg; enum ndr_err_code ndr_err; files_struct *fsp; bool use_kernel; @@ -844,34 +844,22 @@ static void process_oplock_break_message(struct messaging_context *msg_ctx, smb_vfs_assert_allowed(); - msg = talloc(talloc_tos(), struct oplock_break_message); - if (msg == NULL) { - DBG_WARNING("talloc failed\n"); - return; - } - - ndr_err = ndr_pull_struct_blob_all( - data, - msg, - msg, - (ndr_pull_flags_fn_t)ndr_pull_oplock_break_message); + ndr_err = ndr_pull_struct_blob_all_noalloc( + data, &msg, (ndr_pull_flags_fn_t)ndr_pull_oplock_break_message); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { DBG_DEBUG("ndr_pull_oplock_break_message failed: %s\n", ndr_errstr(ndr_err)); - TALLOC_FREE(msg); return; } if (DEBUGLEVEL >= 10) { struct server_id_buf buf; DBG_DEBUG("Got break message from %s\n", server_id_str_buf(src, &buf)); - NDR_PRINT_DEBUG(oplock_break_message, msg); + NDR_PRINT_DEBUG(oplock_break_message, &msg); } - break_to = msg->break_to; - fsp = initial_break_processing(sconn, msg->id, msg->share_file_id); - - TALLOC_FREE(msg); + break_to = msg.break_to; + fsp = initial_break_processing(sconn, msg.id, msg.share_file_id); if (fsp == NULL) { /* We hit a race here. Break messages are sent, and before we