From: Douglas Bagnall Date: Wed, 28 Feb 2024 03:30:29 +0000 (+1300) Subject: pyldb: catch some talloc failures X-Git-Tag: tdb-1.4.11~1653 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ed344bb22f449b977e2ffc30e486446615163110;p=thirdparty%2Fsamba.git pyldb: catch some talloc failures Signed-off-by: Douglas Bagnall Reviewed-by: Andrew Bartlett --- diff --git a/lib/ldb/pyldb.c b/lib/ldb/pyldb.c index b1158d758dc..5faf5f1fe69 100644 --- a/lib/ldb/pyldb.c +++ b/lib/ldb/pyldb.c @@ -3164,6 +3164,10 @@ static PyObject *py_ldb_module_add(PyLdbModuleObject *self, PyObject *args) return NULL; req = talloc_zero(NULL, struct ldb_request); + if (req == NULL) { + PyErr_NoMemory(); + return NULL; + } req->operation = LDB_ADD; req->op.add.message = pyldb_Message_AsMessage(py_message); @@ -3187,6 +3191,11 @@ static PyObject *py_ldb_module_modify(PyLdbModuleObject *self, PyObject *args) return NULL; req = talloc_zero(NULL, struct ldb_request); + if (req == NULL) { + PyErr_NoMemory(); + return NULL; + } + req->operation = LDB_MODIFY; req->op.mod.message = pyldb_Message_AsMessage(py_message); @@ -3209,6 +3218,10 @@ static PyObject *py_ldb_module_delete(PyLdbModuleObject *self, PyObject *args) return NULL; req = talloc_zero(NULL, struct ldb_request); + if (req == NULL) { + PyErr_NoMemory(); + return NULL; + } req->operation = LDB_DELETE; req->op.del.dn = pyldb_Dn_AS_DN(py_dn); @@ -3231,6 +3244,10 @@ static PyObject *py_ldb_module_rename(PyLdbModuleObject *self, PyObject *args) return NULL; req = talloc_zero(NULL, struct ldb_request); + if (req == NULL) { + PyErr_NoMemory(); + return NULL; + } req->operation = LDB_RENAME; req->op.rename.olddn = pyldb_Dn_AS_DN(py_dn1);