]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli: Use GUID_to_ndr_buf() in smbcli_push_guid()
authorVolker Lendecke <vl@samba.org>
Tue, 29 Sep 2020 08:43:29 +0000 (10:43 +0200)
committerJeremy Allison <jra@samba.org>
Fri, 2 Oct 2020 21:30:34 +0000 (21:30 +0000)
Avoid two talloc/free

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

index 5805c2f66fc423cefc50701cf4aa8546294cd116..3a6cf5d700dc4c99350b63b90a6a4093dfe7c03c 100644 (file)
@@ -1043,15 +1043,13 @@ NTSTATUS smbcli_pull_guid(void *base, uint16_t offset,
  */
 NTSTATUS smbcli_push_guid(void *base, uint16_t offset, const struct GUID *guid)
 {
-       TALLOC_CTX *tmp_ctx = talloc_new(NULL);
        NTSTATUS status;
-       DATA_BLOB blob;
-       status = GUID_to_ndr_blob(guid, tmp_ctx, &blob);
+       struct GUID_ndr_buf buf = { .buf = {0}, };
+
+       status = GUID_to_ndr_buf(guid, &buf);
        if (!NT_STATUS_IS_OK(status)) {
-               talloc_free(tmp_ctx);
                return status;
        }
-       memcpy(offset + (uint8_t *)base, blob.data, blob.length);
-       talloc_free(tmp_ctx);
+       memcpy(offset + (uint8_t *)base, buf.buf, sizeof(buf.buf));
        return NT_STATUS_OK;
 }