diff options
author | Kristján Valur <kristjan@rvx.is> | 2019-03-06 14:08:40 +0000 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2019-03-26 03:03:23 +0000 |
commit | 0fa5a77f46fb8a5ce06b93c0064e3ae4ea64084d (patch) | |
tree | 56afa54afbab83783bb701074fe4d505d3892316 /lib | |
parent | b272d161cb35b8860d3e013ec71081a58d2fcd0c (diff) | |
download | samba-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')
-rw-r--r-- | lib/talloc/pytalloc.c | 16 |
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 |