From: Volker Lendecke Date: Fri, 17 Oct 2025 12:24:02 +0000 (+0200) Subject: s3: Replace a few calls to TALLOC() with talloc_array() X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2445d9a9b5b3a51676f092a48def8ed95c3cd6fa;p=thirdparty%2Fsamba.git s3: Replace a few calls to TALLOC() with talloc_array() No explicit cast necessary Signed-off-by: Volker Lendecke Reviewed-by: Anoop C S --- diff --git a/source3/printing/notify.c b/source3/printing/notify.c index 8312b0b612d..80c2a94d1e6 100644 --- a/source3/printing/notify.c +++ b/source3/printing/notify.c @@ -156,7 +156,7 @@ static void print_notify_send_messages_to_printer(struct messaging_context *msg_ } offset += 4; /* For count. */ - buf = (char *)TALLOC(send_ctx, offset); + buf = talloc_array(send_ctx, char, offset); if (!buf) { DEBUG(0,("print_notify_send_messages: Out of memory\n")); talloc_free_children(send_ctx); diff --git a/source3/rpc_client/cli_winreg.c b/source3/rpc_client/cli_winreg.c index a360d1eabcb..42db8e0eac3 100644 --- a/source3/rpc_client/cli_winreg.c +++ b/source3/rpc_client/cli_winreg.c @@ -797,7 +797,7 @@ NTSTATUS dcerpc_winreg_enumvals(TALLOC_CTX *mem_ctx, data_size = max_valbufsize; data = NULL; if (data_size) { - data = (uint8_t *) TALLOC(tmp_ctx, data_size); + data = talloc_array(tmp_ctx, uint8_t, data_size); } length = 0; diff --git a/source3/rpc_client/cli_winreg_spoolss.c b/source3/rpc_client/cli_winreg_spoolss.c index ca46ae53012..ef698db0063 100644 --- a/source3/rpc_client/cli_winreg_spoolss.c +++ b/source3/rpc_client/cli_winreg_spoolss.c @@ -2263,7 +2263,7 @@ WERROR winreg_get_printer_dataex(TALLOC_CTX *mem_ctx, goto done; } - data_in = (uint8_t *) TALLOC(tmp_ctx, data_in_size); + data_in = talloc_array(tmp_ctx, uint8_t, data_in_size); if (data_in == NULL) { result = WERR_NOT_ENOUGH_MEMORY; goto done; @@ -3298,7 +3298,7 @@ WERROR winreg_printer_getform1(TALLOC_CTX *mem_ctx, goto done; } - data_in = (uint8_t *) TALLOC(tmp_ctx, data_in_size); + data_in = talloc_array(tmp_ctx, uint8_t, data_in_size); if (data_in == NULL) { result = WERR_NOT_ENOUGH_MEMORY; goto done; diff --git a/source3/torture/pdbtest.c b/source3/torture/pdbtest.c index d153f3e56c8..059aceaa1d0 100644 --- a/source3/torture/pdbtest.c +++ b/source3/torture/pdbtest.c @@ -636,9 +636,11 @@ int main(int argc, const char **argv) pdb_get_account_policy(PDB_POLICY_PASSWORD_HISTORY, &history); if (history * PW_HISTORY_ENTRY_LEN < NT_HASH_LEN) { - buf = (uint8_t *)TALLOC(ctx, NT_HASH_LEN); + buf = talloc_array(ctx, uint8_t, NT_HASH_LEN); } else { - buf = (uint8_t *)TALLOC(ctx, history * PW_HISTORY_ENTRY_LEN); + buf = talloc_array(ctx, + uint8_t, + history * PW_HISTORY_ENTRY_LEN); } /* Generate some random hashes */ diff --git a/source3/utils/net_rpc_registry.c b/source3/utils/net_rpc_registry.c index cec545902c7..f474317c053 100644 --- a/source3/utils/net_rpc_registry.c +++ b/source3/utils/net_rpc_registry.c @@ -356,7 +356,7 @@ static NTSTATUS registry_enumvalues(TALLOC_CTX *ctx, name_buf.size = max_valnamelen + 2; data_size = max_valbufsize; - data = (uint8_t *)TALLOC(mem_ctx, data_size); + data = talloc_array(mem_ctx, uint8_t, data_size); value_length = 0; status = dcerpc_winreg_EnumValue(b, mem_ctx, key_hnd, @@ -479,7 +479,7 @@ static NTSTATUS registry_enumvalues2(TALLOC_CTX *ctx, name_buf.size = max_valnamelen + 2; data_size = max_valbufsize; - data = (uint8_t *)TALLOC(mem_ctx, data_size); + data = talloc_array(mem_ctx, uint8_t, data_size); value_length = 0; status = dcerpc_winreg_EnumValue(b, mem_ctx, key_hnd,