summaryrefslogtreecommitdiff
path: root/lib/talloc
diff options
context:
space:
mode:
authorKristján Valur <kristjan@rvx.is>2019-03-06 14:08:40 +0000
committerAndrew Bartlett <abartlet@samba.org>2019-03-26 03:03:23 +0000
commit0fa5a77f46fb8a5ce06b93c0064e3ae4ea64084d (patch)
tree56afa54afbab83783bb701074fe4d505d3892316 /lib/talloc
parentb272d161cb35b8860d3e013ec71081a58d2fcd0c (diff)
downloadsamba-0fa5a77f46fb8a5ce06b93c0064e3ae4ea64084d.tar.gz
pytalloc: Check for errors during module initialization.
Signed-off-by: Kristján Valur <kristjan@rvx.is> Reviewed-by: Noel Power <npower@samba.org> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'lib/talloc')
-rw-r--r--lib/talloc/pytalloc.c16
1 files changed, 13 insertions, 3 deletions
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