[PATCH 2/6] messaging: use local talloc ctx instead of talloc_tos
David Disseldorp
ddiss at samba.org
Tue Nov 19 16:48:50 MST 2013
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 at samba.org>
---
source3/lib/messages_local.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/source3/lib/messages_local.c b/source3/lib/messages_local.c
index 6b63d72..c74c0aa 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:
--
1.8.1.4
More information about the samba-technical
mailing list