From: Volker Lendecke Date: Tue, 29 Sep 2020 08:43:29 +0000 (+0200) Subject: libcli: Use GUID_to_ndr_buf() in smbcli_push_guid() X-Git-Tag: talloc-2.3.2~307 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b1fa3e2bcc5fc2e08d335d2eb470c37f744cb5ab;p=thirdparty%2Fsamba.git libcli: Use GUID_to_ndr_buf() in smbcli_push_guid() Avoid two talloc/free Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source4/libcli/raw/rawrequest.c b/source4/libcli/raw/rawrequest.c index 5805c2f66fc..3a6cf5d700d 100644 --- a/source4/libcli/raw/rawrequest.c +++ b/source4/libcli/raw/rawrequest.c @@ -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; }