diff options
author | Petr Viktorin <pviktori@redhat.com> | 2015-03-03 22:29:08 +0100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2015-03-03 23:20:06 +0100 |
commit | f87e6df34ac05b352c6c74bf1fd1d678ee23217f (patch) | |
tree | ff3b9e75a25d5df20f1c53a98a11d60f5a18840e /lib/ldb | |
parent | 92ff259f409cfeffc24ef9d7db8ab16217367bab (diff) | |
download | samba-f87e6df34ac05b352c6c74bf1fd1d678ee23217f.tar.gz |
pyldb: Properly preallocate result control list
The list was always allocated with size 1, so
if there is more than 1 result control, the additional
items would not be added in the list, and would
become leaked references.
Signed-off-by: Petr Viktorin <pviktori@redhat.com>
Reviewed-by: Jelmer Vernooij <jelmer@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/ldb')
-rw-r--r-- | lib/ldb/pyldb.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index 4f452fa5e75..9ee71eb73fa 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -269,7 +269,11 @@ static PyObject *PyLdbResult_FromResult(struct ldb_result *result) ret->msgs = list; if (result->controls) { - controls = PyList_New(1); + i = 0; + while (result->controls[i]) { + i++; + } + controls = PyList_New(i); if (controls == NULL) { Py_DECREF(ret); PyErr_NoMemory(); |