libcli: Use GUID_to_ndr_buf() in ldap_encode_ndr_GUID()
authorVolker Lendecke <vl@samba.org>
Tue, 29 Sep 2020 08:13:20 +0000 (10:13 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 2 Oct 2020 21:30:33 +0000 (21:30 +0000)
Avoid a talloc/free

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
libcli/ldap/ldap_ndr.c

index 1743415f0fd994cce7f5d8357c81a4e14531f8db..4f63bc179e7a73a61e135b2f51802ba9757fb665 100644 (file)
@@ -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;
 }