summaryrefslogtreecommitdiff
path: root/source4/librpc
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2021-04-16 09:15:43 +0200
committerJeremy Allison <jra@samba.org>2021-04-19 18:18:32 +0000
commitd298623c85dcf2d018c5ad83b9959b805ad42929 (patch)
tree056e27737955e25788d4ed905ed4eb77b0661635 /source4/librpc
parentebea5639cf75f6821bf9fd1a2efcfc086f8b4866 (diff)
downloadsamba-d298623c85dcf2d018c5ad83b9959b805ad42929.tar.gz
librpc: Use GUID_buf_string() in python wrappers
No need for the talloc'ed strings Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4/librpc')
-rw-r--r--source4/librpc/ndr/py_misc.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/source4/librpc/ndr/py_misc.c b/source4/librpc/ndr/py_misc.c
index 2f66070d1bd..ea2092a5182 100644
--- a/source4/librpc/ndr/py_misc.c
+++ b/source4/librpc/ndr/py_misc.c
@@ -68,18 +68,17 @@ static int py_GUID_cmp(PyObject *py_self, PyObject *py_other)
static PyObject *py_GUID_str(PyObject *py_self)
{
struct GUID *self = pytalloc_get_ptr(py_self);
- char *str = GUID_string(NULL, self);
- PyObject *ret = PyUnicode_FromString(str);
- talloc_free(str);
+ struct GUID_txt_buf buf;
+ PyObject *ret = PyUnicode_FromString(GUID_buf_string(self, &buf));
return ret;
}
static PyObject *py_GUID_repr(PyObject *py_self)
{
struct GUID *self = pytalloc_get_ptr(py_self);
- char *str = GUID_string(NULL, self);
- PyObject *ret = PyUnicode_FromFormat("GUID('%s')", str);
- talloc_free(str);
+ struct GUID_txt_buf buf;
+ PyObject *ret = PyUnicode_FromFormat(
+ "GUID('%s')", GUID_buf_string(self, &buf));
return ret;
}
@@ -160,18 +159,22 @@ static int py_policy_handle_init(PyObject *self, PyObject *args, PyObject *kwarg
static PyObject *py_policy_handle_repr(PyObject *py_self)
{
struct policy_handle *self = pytalloc_get_ptr(py_self);
- char *uuid_str = GUID_string(NULL, &self->uuid);
- PyObject *ret = PyUnicode_FromFormat("policy_handle(%d, '%s')", self->handle_type, uuid_str);
- talloc_free(uuid_str);
+ struct GUID_txt_buf buf;
+ PyObject *ret = PyUnicode_FromFormat(
+ "policy_handle(%d, '%s')",
+ self->handle_type,
+ GUID_buf_string(&self->uuid, &buf));
return ret;
}
static PyObject *py_policy_handle_str(PyObject *py_self)
{
struct policy_handle *self = pytalloc_get_ptr(py_self);
- char *uuid_str = GUID_string(NULL, &self->uuid);
- PyObject *ret = PyUnicode_FromFormat("%d, %s", self->handle_type, uuid_str);
- talloc_free(uuid_str);
+ struct GUID_txt_buf buf;
+ PyObject *ret = PyUnicode_FromFormat(
+ "%d, %s",
+ self->handle_type,
+ GUID_buf_string(&self->uuid, &buf));
return ret;
}