From: Stefan Metzmacher Date: Thu, 10 Oct 2024 11:24:37 +0000 (+0200) Subject: libcli/auth: let netlogon_creds_cli_store_internal() use talloc_stackframe() X-Git-Tag: ldb-2.9.2~38 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=bc8dcaa109e4a1ddd04bdb3d4aaf9841fbac8673;p=thirdparty%2Fsamba.git 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) --- 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; }