From 77877cfed19ea98bfac3ba43529589f4cdd33714 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 29 Sep 2020 10:13:20 +0200 Subject: [PATCH] libcli: Use GUID_to_ndr_buf() in ldap_encode_ndr_GUID() Avoid a talloc/free Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- libcli/ldap/ldap_ndr.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libcli/ldap/ldap_ndr.c b/libcli/ldap/ldap_ndr.c index 1743415f0fd..4f63bc179e7 100644 --- a/libcli/ldap/ldap_ndr.c +++ b/libcli/ldap/ldap_ndr.c @@ -63,15 +63,15 @@ char *ldap_encode_ndr_dom_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid) */ char *ldap_encode_ndr_GUID(TALLOC_CTX *mem_ctx, const struct GUID *guid) { - DATA_BLOB blob; + struct GUID_ndr_buf buf = { .buf = {0}, }; + DATA_BLOB blob = { .data = buf.buf, .length = sizeof(buf.buf), }; NTSTATUS status; char *ret; - status = GUID_to_ndr_blob(guid, mem_ctx, &blob); + status = GUID_to_ndr_buf(guid, &buf); if (!NT_STATUS_IS_OK(status)) { return NULL; } ret = ldb_binary_encode(mem_ctx, blob); - data_blob_free(&blob); return ret; }