diff options
author | Joseph Sutton <josephsutton@catalyst.net.nz> | 2021-05-28 14:15:43 +1200 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2021-11-02 20:36:16 +0000 |
commit | 2c8091ab9730ef00457f6bf5cf829ad9f4f6d824 (patch) | |
tree | 8e45eeb180964bcf5d224b92731b5a7e5bcc0e3f | |
parent | 7c3f03589ac7030491aaa0c6efb9647326b0560f (diff) | |
download | samba-2c8091ab9730ef00457f6bf5cf829ad9f4f6d824.tar.gz |
pyldb: Fix Message.items() for a message containing elements
Previously, message elements were being freed before the call to
Py_BuildValue(), resulting in an exception being raised. Additionally,
only the first element of the returned list was ever assigned to.
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit 3e4ec0a90a222c1cff4a91912afc703ca4cbbb0e)
-rw-r--r-- | lib/ldb/pyldb.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 257351b2bc4..df7c5c54eaa 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -3535,13 +3535,13 @@ static PyObject *py_ldb_msg_items(PyLdbMessageObject *self, PyObject *value = NULL; PyObject *py_el = PyLdbMessageElement_FromMessageElement(&msg->elements[i], msg->elements); int res = 0; - Py_CLEAR(py_el); value = Py_BuildValue("(sO)", msg->elements[i].name, py_el); + Py_CLEAR(py_el); if (value == NULL ) { Py_CLEAR(l); return NULL; } - res = PyList_SetItem(l, 0, value); + res = PyList_SetItem(l, j, value); if (res == -1) { Py_CLEAR(l); return NULL; |