]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pyldb: catch some talloc failures
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Wed, 28 Feb 2024 03:30:29 +0000 (16:30 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Thu, 29 Feb 2024 04:01:40 +0000 (04:01 +0000)
Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
lib/ldb/pyldb.c

index b1158d758dc9607dc62d8e931f31045b120ddbd9..5faf5f1fe693a4be06fdb3eb5054f25c6aef5557 100644 (file)
@@ -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);