summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-04-07 20:40:06 +0200
committerMatthias Dieter Wallnöfer <mwallnoefer@yahoo.de>2010-04-07 20:40:06 +0200
commitbaf81a0e08099dc863a014eb6e03b6e877ae8b93 (patch)
treeec01a7246c53f8690d2d39260789ed642e107c0f
parent79fccc45bc3acac5d9b15a3585e2526a3b1876f2 (diff)
downloadsamba-baf81a0e08099dc863a014eb6e03b6e877ae8b93.tar.gz
samba-baf81a0e08099dc863a014eb6e03b6e877ae8b93.tar.bz2
samba-baf81a0e08099dc863a014eb6e03b6e877ae8b93.zip
LDB:python bindings - also empty LDB message elements should have a python representation
Bug found by ekacnet (see technical mailing list).
-rw-r--r--source4/lib/ldb/pyldb.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c
index 4ff56b4e2b..737d3fbdff 100644
--- a/source4/lib/ldb/pyldb.c
+++ b/source4/lib/ldb/pyldb.c
@@ -1827,9 +1827,12 @@ static PyObject *py_ldb_msg_element_repr(PyLdbMessageElementObject *self)
element_str = talloc_asprintf_append(element_str, ",%s", PyObject_REPR(o));
}
- ret = PyString_FromFormat("MessageElement([%s])", element_str);
-
- talloc_free(element_str);
+ if (element_str != NULL) {
+ ret = PyString_FromFormat("MessageElement([%s])", element_str);
+ talloc_free(element_str);
+ } else {
+ ret = PyString_FromString("MessageElement([])");
+ }
return ret;
}