pysecurity: Use dom_sid_str_buf
authorVolker Lendecke <vl@samba.org>
Sun, 16 Dec 2018 16:12:19 +0000 (17:12 +0100)
committerJeremy Allison <jra@samba.org>
Tue, 8 Jan 2019 02:40:28 +0000 (03:40 +0100)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source4/librpc/ndr/py_security.c

index 8288748..eb5224d 100644 (file)
@@ -114,18 +114,17 @@ static int py_dom_sid_cmp(PyObject *py_self, PyObject *py_other)
 static PyObject *py_dom_sid_str(PyObject *py_self)
 {
        struct dom_sid *self = pytalloc_get_ptr(py_self);
-       char *str = dom_sid_string(NULL, self);
-       PyObject *ret = PyStr_FromString(str);
-       talloc_free(str);
+       struct dom_sid_buf buf;
+       PyObject *ret = PyStr_FromString(dom_sid_str_buf(self, &buf));
        return ret;
 }
 
 static PyObject *py_dom_sid_repr(PyObject *py_self)
 {
        struct dom_sid *self = pytalloc_get_ptr(py_self);
-       char *str = dom_sid_string(NULL, self);
-       PyObject *ret = PyStr_FromFormat("dom_sid('%s')", str);
-       talloc_free(str);
+       struct dom_sid_buf buf;
+       PyObject *ret = PyStr_FromFormat(
+               "dom_sid('%s')", dom_sid_str_buf(self, &buf));
        return ret;
 }