From bac02f087c966e7935206ca7593f405de071ced3 Mon Sep 17 00:00:00 2001 From: Joseph Sutton Date: Fri, 25 Aug 2023 11:49:27 +1200 Subject: [PATCH] =?utf8?q?s4:kdc:=20Don=E2=80=99t=20operate=20directly=20o?= =?utf8?q?n=20caller=E2=80=90owned=20pointer?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This is more consistent with the other PAC blob functions, and easier to reason about. Signed-off-by: Joseph Sutton Reviewed-by: Andrew Bartlett --- source4/kdc/pac-glue.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/source4/kdc/pac-glue.c b/source4/kdc/pac-glue.c index 8c7601984dd..a8f9ac90c00 100644 --- a/source4/kdc/pac-glue.c +++ b/source4/kdc/pac-glue.c @@ -1882,17 +1882,20 @@ static krb5_error_code samba_kdc_update_device_info(TALLOC_CTX *mem_ctx, static krb5_error_code samba_kdc_get_device_info_pac_blob(TALLOC_CTX *mem_ctx, union PAC_INFO *info, - DATA_BLOB **device_info_blob) + DATA_BLOB **_device_info_blob) { + DATA_BLOB *device_info_blob = NULL; enum ndr_err_code ndr_err; - *device_info_blob = talloc_zero(mem_ctx, DATA_BLOB); - if (*device_info_blob == NULL) { + *_device_info_blob = NULL; + + device_info_blob = talloc_zero(mem_ctx, DATA_BLOB); + if (device_info_blob == NULL) { DBG_ERR("Out of memory\n"); return ENOMEM; } - ndr_err = ndr_push_union_blob(*device_info_blob, *device_info_blob, + ndr_err = ndr_push_union_blob(device_info_blob, device_info_blob, info, PAC_TYPE_DEVICE_INFO, (ndr_push_flags_fn_t)ndr_push_PAC_INFO); if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) { @@ -1902,6 +1905,8 @@ static krb5_error_code samba_kdc_get_device_info_pac_blob(TALLOC_CTX *mem_ctx, return map_errno_from_nt_status(nt_status); } + *_device_info_blob = device_info_blob; + return 0; } -- 2.47.3