diff options
author | Volker Lendecke <vl@samba.org> | 2021-04-16 09:15:43 +0200 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2021-04-19 18:18:32 +0000 |
commit | d298623c85dcf2d018c5ad83b9959b805ad42929 (patch) | |
tree | 056e27737955e25788d4ed905ed4eb77b0661635 /source4/librpc | |
parent | ebea5639cf75f6821bf9fd1a2efcfc086f8b4866 (diff) | |
download | samba-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.c | 27 |
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; } |