in case py_ldb is not a valid LDB
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");