summaryrefslogtreecommitdiff
path: root/source4
diff options
context:
space:
mode:
authorKamen Mazdrashki <kamenim@samba.org>2010-11-08 23:40:14 +0200
committerKamen Mazdrashki <kamenim@samba.org>2010-11-10 10:20:01 +0200
commit89440dd617eb4ff64cda8bf97f1f22ddf94bf717 (patch)
treea3aef7f8e85aabc4c6b89aece6c033bf60e0fd59 /source4
parent06b0596537e66ed928b24af059ada0472a375f3b (diff)
downloadsamba-89440dd617eb4ff64cda8bf97f1f22ddf94bf717.tar.gz
samba-89440dd617eb4ff64cda8bf97f1f22ddf94bf717.tar.bz2
samba-89440dd617eb4ff64cda8bf97f1f22ddf94bf717.zip
s4-pydsdb-py_samdb_ntds_objectGUID(): Avoid potential memory leak
in case py_ldb is not a valid LDB
Diffstat (limited to 'source4')
-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");