diff options
author | Noel Power <noel.power@suse.com> | 2019-01-28 15:23:48 +0000 |
---|---|---|
committer | Noel Power <npower@samba.org> | 2019-02-13 11:42:08 +0100 |
commit | 5dad03b83cd014277e2712ab04ad8a714d78a24c (patch) | |
tree | 9b5a033ec7f75d3989018c082f08b7a03a9524f9 /source4/auth | |
parent | 30d505e91bbf8e08d6f80314798e4e1a48ae43f9 (diff) | |
download | samba-5dad03b83cd014277e2712ab04ad8a714d78a24c.tar.gz |
Fix mem leak with PyBytes_FromStringAndSize
Reviewed-by: Andrew Bartlett abartlet@samba.org
Diffstat (limited to 'source4/auth')
-rw-r--r-- | source4/auth/gensec/pygensec.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/source4/auth/gensec/pygensec.c b/source4/auth/gensec/pygensec.c index d8f782f8d19..72981a22263 100644 --- a/source4/auth/gensec/pygensec.c +++ b/source4/auth/gensec/pygensec.c @@ -453,7 +453,7 @@ static PyObject *py_gensec_update(PyObject *self, PyObject *args) NTSTATUS status; TALLOC_CTX *mem_ctx; DATA_BLOB in, out; - PyObject *ret, *py_in; + PyObject *py_bytes, *result, *py_in; struct gensec_security *security = pytalloc_get_type(self, struct gensec_security); PyObject *finished_processing; @@ -477,7 +477,8 @@ static PyObject *py_gensec_update(PyObject *self, PyObject *args) talloc_free(mem_ctx); return NULL; } - ret = PyBytes_FromStringAndSize((const char *)out.data, out.length); + py_bytes = PyBytes_FromStringAndSize((const char *)out.data, + out.length); talloc_free(mem_ctx); if (NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED)) { @@ -486,7 +487,9 @@ static PyObject *py_gensec_update(PyObject *self, PyObject *args) finished_processing = Py_True; } - return PyTuple_Pack(2, finished_processing, ret); + result = PyTuple_Pack(2, finished_processing, py_bytes); + Py_XDECREF(py_bytes); + return result; } static PyObject *py_gensec_wrap(PyObject *self, PyObject *args) |