summaryrefslogtreecommitdiff
path: root/source4/dsdb/pydsdb.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/dsdb/pydsdb.c')
-rw-r--r--source4/dsdb/pydsdb.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c
index e270d7458b..41985ba648 100644
--- a/source4/dsdb/pydsdb.c
+++ b/source4/dsdb/pydsdb.c
@@ -414,19 +414,18 @@ static PyObject *py_samdb_ntds_objectGUID(PyObject *self, PyObject *args)
TALLOC_CTX *mem_ctx;
const struct GUID *guid;
- mem_ctx = talloc_new(NULL);
- if (mem_ctx == NULL) {
- PyErr_NoMemory();
- return NULL;
- }
-
if (!PyArg_ParseTuple(args, "O", &py_ldb)) {
- talloc_free(mem_ctx);
return NULL;
}
PyErr_LDB_OR_RAISE(py_ldb, ldb);
+ mem_ctx = talloc_new(NULL);
+ if (mem_ctx == NULL) {
+ PyErr_NoMemory();
+ return NULL;
+ }
+
guid = samdb_ntds_objectGUID(ldb);
if (guid == NULL) {
PyErr_SetString(PyExc_RuntimeError, "Failed to find NTDS GUID");