From: Kristján Valur Date: Wed, 6 Mar 2019 14:08:40 +0000 (+0000) Subject: pytalloc: Check for errors during module initialization. X-Git-Tag: tdb-1.4.1~624 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0fa5a77f46fb8a5ce06b93c0064e3ae4ea64084d;p=thirdparty%2Fsamba.git pytalloc: Check for errors during module initialization. Signed-off-by: Kristján Valur Reviewed-by: Noel Power Reviewed-by: Andrew Bartlett --- diff --git a/lib/talloc/pytalloc.c b/lib/talloc/pytalloc.c index 95dbb297a46..ad3ad969a0f 100644 --- a/lib/talloc/pytalloc.c +++ b/lib/talloc/pytalloc.c @@ -281,12 +281,22 @@ static PyObject *module_init(void) return NULL; Py_INCREF(&TallocObject_Type); - PyModule_AddObject(m, "Object", (PyObject *)&TallocObject_Type); + if (PyModule_AddObject(m, "Object", (PyObject *)&TallocObject_Type)) { + goto err; + } Py_INCREF(&TallocBaseObject_Type); - PyModule_AddObject(m, "BaseObject", (PyObject *)&TallocBaseObject_Type); + if (PyModule_AddObject(m, "BaseObject", (PyObject *)&TallocBaseObject_Type)) { + goto err; + } Py_INCREF(&TallocGenericObject_Type); - PyModule_AddObject(m, "GenericObject", (PyObject *)&TallocGenericObject_Type); + if (PyModule_AddObject(m, "GenericObject", (PyObject *)&TallocGenericObject_Type)) { + goto err; + } return m; + +err: + Py_DECREF(m); + return NULL; } #if PY_MAJOR_VERSION >= 3