From: Matthieu Patou Date: Sun, 3 Oct 2010 20:43:33 +0000 (+0400) Subject: pyldb: test return code before trying to talloc_steal X-Git-Url: http://git.samba.org/?p=mat%2Fsamba.git;a=commitdiff_plain;h=9dcad792b6d5ff0481da467b1c6b4524cf462ba8 pyldb: test return code before trying to talloc_steal Otherwise you can have an error on the talloc_steal as the req can have been not talloced yet --- diff --git a/source4/lib/ldb/pyldb.c b/source4/lib/ldb/pyldb.c index 57407ba0b6..25f4661dce 100644 --- a/source4/lib/ldb/pyldb.c +++ b/source4/lib/ldb/pyldb.c @@ -1212,14 +1212,14 @@ static PyObject *py_ldb_search(PyLdbObject *self, PyObject *args, PyObject *kwar ldb_search_default_callback, NULL); - talloc_steal(req, attrs); - if (ret != LDB_SUCCESS) { talloc_free(mem_ctx); PyErr_LDB_ERROR_IS_ERR_RAISE(PyExc_LdbError, ret, ldb_ctx); return NULL; } + talloc_steal(req, attrs); + ret = ldb_request(ldb_ctx, req); if (ret == LDB_SUCCESS) {