diff options
author | Volker Lendecke <vl@samba.org> | 2014-01-08 16:15:27 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-01-09 14:20:34 -0800 |
commit | b2c85ee90e201bc95e09c90f712f69d7413bc4b4 (patch) | |
tree | 1aa60056e73aff0e9e0d45385567965ebe3fc611 /source3/lib/messages.c | |
parent | 0c2f85a66ca0d971c6008a62c4fa732112638934 (diff) | |
download | samba-b2c85ee90e201bc95e09c90f712f69d7413bc4b4.tar.gz samba-b2c85ee90e201bc95e09c90f712f69d7413bc4b4.tar.xz samba-b2c85ee90e201bc95e09c90f712f69d7413bc4b4.zip |
messaging: Use talloc_pooled_object
... not as a speed improvement, it saves the second NULL check
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source3/lib/messages.c')
-rw-r--r-- | source3/lib/messages.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/source3/lib/messages.c b/source3/lib/messages.c index fa3855cae58..e6681b54d8c 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -381,7 +381,8 @@ NTSTATUS messaging_send(struct messaging_context *msg_ctx, return NT_STATUS_NO_MEMORY; } - state = talloc(im, struct messaging_selfsend_state); + state = talloc_pooled_object( + im, struct messaging_selfsend_state, 1, data->length); if (state == NULL) { TALLOC_FREE(im); return NT_STATUS_NO_MEMORY; @@ -392,13 +393,9 @@ NTSTATUS messaging_send(struct messaging_context *msg_ctx, state->rec.dest = server; state->rec.src = msg_ctx->id; + /* Can't fail, it's a pooled_object */ state->rec.buf = data_blob_talloc( state, data->data, data->length); - if ((state->rec.buf.length != 0) && - (state->rec.buf.data == NULL)) { - TALLOC_FREE(im); - return NT_STATUS_NO_MEMORY; - } tevent_schedule_immediate(im, msg_ctx->event_ctx, messaging_trigger_self, state); |