1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-26 10:04:02 +03:00

s4-pydsdb-py_samdb_ntds_objectGUID(): Avoid potential memory leak

in case py_ldb is not a valid LDB
This commit is contained in:
Kamen Mazdrashki 2010-11-08 23:40:14 +02:00
parent 06b0596537
commit 89440dd617

View File

@ -414,19 +414,18 @@ static PyObject *py_samdb_ntds_objectGUID(PyObject *self, PyObject *args)
TALLOC_CTX *mem_ctx;
const struct GUID *guid;
if (!PyArg_ParseTuple(args, "O", &py_ldb)) {
return NULL;
}
PyErr_LDB_OR_RAISE(py_ldb, ldb);
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);
guid = samdb_ntds_objectGUID(ldb);
if (guid == NULL) {
PyErr_SetString(PyExc_RuntimeError, "Failed to find NTDS GUID");