diff options
author | Volker Lendecke <vl@samba.org> | 2014-01-08 16:32:39 +0100 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2014-01-10 01:20:03 +0100 |
commit | 0045f3b0a3d232103a059f9cec3743486f402452 (patch) | |
tree | 54c67eddaa859767354cdbf517f75eeae0f85479 /source3 | |
parent | b2c85ee90e201bc95e09c90f712f69d7413bc4b4 (diff) | |
download | samba-0045f3b0a3d232103a059f9cec3743486f402452.tar.gz samba-0045f3b0a3d232103a059f9cec3743486f402452.tar.xz samba-0045f3b0a3d232103a059f9cec3743486f402452.zip |
messaging: Fix a memleak (master only..)
Immediate tevents don't free themselves as timed events do :-)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Fri Jan 10 01:20:04 CET 2014 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r-- | source3/lib/messages.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/source3/lib/messages.c b/source3/lib/messages.c index e6681b54d8..ba473ae8ae 100644 --- a/source3/lib/messages.c +++ b/source3/lib/messages.c @@ -376,15 +376,10 @@ NTSTATUS messaging_send(struct messaging_context *msg_ctx, struct messaging_selfsend_state *state; struct tevent_immediate *im; - im = tevent_create_immediate(msg_ctx); - if (im == NULL) { - return NT_STATUS_NO_MEMORY; - } - state = talloc_pooled_object( - im, struct messaging_selfsend_state, 1, data->length); + msg_ctx, struct messaging_selfsend_state, + 1, data->length); if (state == NULL) { - TALLOC_FREE(im); return NT_STATUS_NO_MEMORY; } state->msg = msg_ctx; @@ -397,6 +392,12 @@ NTSTATUS messaging_send(struct messaging_context *msg_ctx, state->rec.buf = data_blob_talloc( state, data->data, data->length); + im = tevent_create_immediate(state); + if (im == NULL) { + TALLOC_FREE(state); + return NT_STATUS_NO_MEMORY; + } + tevent_schedule_immediate(im, msg_ctx->event_ctx, messaging_trigger_self, state); return NT_STATUS_OK; @@ -413,6 +414,7 @@ static void messaging_trigger_self(struct tevent_context *ev, struct messaging_selfsend_state *state = talloc_get_type_abort( private_data, struct messaging_selfsend_state); messaging_dispatch_rec(state->msg, &state->rec); + TALLOC_FREE(state); } NTSTATUS messaging_send_buf(struct messaging_context *msg_ctx, |