From bc8dcaa109e4a1ddd04bdb3d4aaf9841fbac8673 Mon Sep 17 00:00:00 2001 From: Stefan Metzmacher Date: Thu, 10 Oct 2024 13:24:37 +0200 Subject: [PATCH] libcli/auth: let netlogon_creds_cli_store_internal() use talloc_stackframe() BUG: https://bugzilla.samba.org/show_bug.cgi?id=15425 Signed-off-by: Stefan Metzmacher Reviewed-by: Douglas Bagnall (cherry picked from commit 17394ed7bbf8fa50570a5732f1ce84ccd5e69393) --- libcli/auth/netlogon_creds_cli.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libcli/auth/netlogon_creds_cli.c b/libcli/auth/netlogon_creds_cli.c index 35a5462ff2e..1b9d26171e1 100644 --- a/libcli/auth/netlogon_creds_cli.c +++ b/libcli/auth/netlogon_creds_cli.c @@ -747,6 +747,7 @@ static NTSTATUS netlogon_creds_cli_store_internal( struct netlogon_creds_cli_context *context, struct netlogon_creds_CredentialState *creds) { + TALLOC_CTX *frame = talloc_stackframe(); NTSTATUS status; enum ndr_err_code ndr_err; DATA_BLOB blob; @@ -756,10 +757,11 @@ static NTSTATUS netlogon_creds_cli_store_internal( NDR_PRINT_DEBUG(netlogon_creds_CredentialState, creds); } - ndr_err = ndr_push_struct_blob(&blob, creds, creds, + ndr_err = ndr_push_struct_blob(&blob, frame, creds, (ndr_push_flags_fn_t)ndr_push_netlogon_creds_CredentialState); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { status = ndr_map_error2ntstatus(ndr_err); + TALLOC_FREE(frame); return status; } @@ -769,11 +771,12 @@ static NTSTATUS netlogon_creds_cli_store_internal( status = dbwrap_store(context->db.ctx, context->db.key_data, data, TDB_REPLACE); - TALLOC_FREE(data.dptr); if (!NT_STATUS_IS_OK(status)) { + TALLOC_FREE(frame); return status; } + TALLOC_FREE(frame); return NT_STATUS_OK; }