diff options
author | Kamen Mazdrashki <kamenim@samba.org> | 2010-11-08 23:40:14 +0200 |
---|---|---|
committer | Kamen Mazdrashki <kamenim@samba.org> | 2010-11-10 10:20:01 +0200 |
commit | 89440dd617eb4ff64cda8bf97f1f22ddf94bf717 (patch) | |
tree | a3aef7f8e85aabc4c6b89aece6c033bf60e0fd59 /source4 | |
parent | 06b0596537e66ed928b24af059ada0472a375f3b (diff) | |
download | samba-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.c | 13 |
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"); |