diff options
| author | David Disseldorp <ddiss@samba.org> | 2013-10-16 18:31:17 +0200 |
|---|---|---|
| committer | Günther Deschner <gd@samba.org> | 2013-11-20 08:16:33 +0100 |
| commit | de424133653c00a2a95017be15a25cbb0b3c0524 (patch) | |
| tree | 4f5e447bb91dde5127935a1fd7f1af44f199c2e9 | |
| parent | 956a4552f2c66cfe61493de772b5986d95511135 (diff) | |
| download | samba-de424133653c00a2a95017be15a25cbb0b3c0524.tar.gz samba-de424133653c00a2a95017be15a25cbb0b3c0524.tar.xz samba-de424133653c00a2a95017be15a25cbb0b3c0524.zip | |
messaging: use local talloc ctx instead of talloc_tos
messaging_tdb_send() allocates a stackframe and stores it in a local
variable, subsequent allocations should use the variable instead of
calling talloc_tos().
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Guenther Deschner <gd@samba.org>
| -rw-r--r-- | source3/lib/messages_local.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/source3/lib/messages_local.c b/source3/lib/messages_local.c index 6b63d72925..c74c0aa0d0 100644 --- a/source3/lib/messages_local.c +++ b/source3/lib/messages_local.c @@ -191,7 +191,7 @@ static TDB_DATA message_key_pid(TALLOC_CTX *mem_ctx, struct server_id pid) char *key; TDB_DATA kbuf; - key = talloc_asprintf(talloc_tos(), "PID/%s", procid_str_static(&pid)); + key = talloc_asprintf(mem_ctx, "PID/%s", procid_str_static(&pid)); SMB_ASSERT(key != NULL); @@ -387,7 +387,7 @@ static NTSTATUS messaging_tdb_send(struct messaging_context *msg_ctx, return NT_STATUS_LOCK_NOT_GRANTED; } - status = messaging_tdb_fetch(tdb->tdb, key, talloc_tos(), &msg_array); + status = messaging_tdb_fetch(tdb->tdb, key, frame, &msg_array); if (!NT_STATUS_IS_OK(status)) { goto done; @@ -401,7 +401,7 @@ static NTSTATUS messaging_tdb_send(struct messaging_context *msg_ctx, goto done; } - if (!(rec = talloc_realloc(talloc_tos(), msg_array->messages, + if (!(rec = talloc_realloc(frame, msg_array->messages, struct messaging_rec, msg_array->num_messages+1))) { status = NT_STATUS_NO_MEMORY; @@ -428,7 +428,7 @@ static NTSTATUS messaging_tdb_send(struct messaging_context *msg_ctx, if (NT_STATUS_EQUAL(status, NT_STATUS_INVALID_HANDLE)) { DEBUG(2, ("pid %s doesn't exist - deleting messages record\n", procid_str_static(&pid))); - tdb_delete(tdb->tdb, message_key_pid(talloc_tos(), pid)); + tdb_delete(tdb->tdb, message_key_pid(frame, pid)); } done: |
