mirror of
https://github.com/samba-team/samba.git
synced 2025-02-23 09:57:40 +03:00
librpc: Simplify GUID_hexstring()
A temporary talloc context seems unnecessary to me. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
This commit is contained in:
parent
0cddd3f2d6
commit
9857c56256
@ -230,23 +230,15 @@ _PUBLIC_ char *GUID_string2(TALLOC_CTX *mem_ctx, const struct GUID *guid)
|
||||
|
||||
_PUBLIC_ char *GUID_hexstring(TALLOC_CTX *mem_ctx, const struct GUID *guid)
|
||||
{
|
||||
char *ret;
|
||||
DATA_BLOB guid_blob;
|
||||
TALLOC_CTX *tmp_mem;
|
||||
char *ret = NULL;
|
||||
DATA_BLOB guid_blob = { .data = NULL };
|
||||
NTSTATUS status;
|
||||
|
||||
tmp_mem = talloc_new(mem_ctx);
|
||||
if (!tmp_mem) {
|
||||
return NULL;
|
||||
status = GUID_to_ndr_blob(guid, mem_ctx, &guid_blob);
|
||||
if (NT_STATUS_IS_OK(status)) {
|
||||
ret = data_blob_hex_string_upper(mem_ctx, &guid_blob);
|
||||
}
|
||||
status = GUID_to_ndr_blob(guid, tmp_mem, &guid_blob);
|
||||
if (!NT_STATUS_IS_OK(status)) {
|
||||
talloc_free(tmp_mem);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = data_blob_hex_string_upper(mem_ctx, &guid_blob);
|
||||
talloc_free(tmp_mem);
|
||||
TALLOC_FREE(guid_blob.data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user