]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/auth: let netlogon_creds_cli_store_internal() use talloc_stackframe()
authorStefan Metzmacher <metze@samba.org>
Thu, 10 Oct 2024 11:24:37 +0000 (13:24 +0200)
committerJule Anger <janger@samba.org>
Wed, 13 Nov 2024 10:39:12 +0000 (10:39 +0000)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15425

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit 17394ed7bbf8fa50570a5732f1ce84ccd5e69393)

libcli/auth/netlogon_creds_cli.c

index 35a5462ff2e76bf7b9a4c63c05877682a6da2443..1b9d26171e1093e825c022d94cb7a81f786d8329 100644 (file)
@@ -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;
 }