summaryrefslogtreecommitdiffstats
path: root/lib/ldb/pyldb.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ldb/pyldb.c')
-rw-r--r--lib/ldb/pyldb.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c
index 4f452fa5e7..9ee71eb73f 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();