Module: kamailio
Branch: master
Commit: 72cd0ac533d4e6b881aa5e4f2e1724c6da312ca2
URL: https://github.com/kamailio/kamailio/commit/72cd0ac533d4e6b881aa5e4f2e1724c…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-01-10T13:21:27+01:00
app_python3s: checks for function execution handler
---
Modified: src/modules/app_python3s/app_python3s_mod.c
---
Diff: https://github.com/kamailio/kamailio/commit/72cd0ac533d4e6b881aa5e4f2e1724c…
Patch: https://github.com/kamailio/kamailio/commit/72cd0ac533d4e6b881aa5e4f2e1724c…
---
diff --git a/src/modules/app_python3s/app_python3s_mod.c b/src/modules/app_python3s/app_python3s_mod.c
index ba68d019e2..f2614f27a8 100644
--- a/src/modules/app_python3s/app_python3s_mod.c
+++ b/src/modules/app_python3s/app_python3s_mod.c
@@ -323,7 +323,9 @@ int apy3s_script_init_exec(PyObject* pModule, str *fname, int *vparam)
if (PyErr_Occurred()) {
LM_ERR("error exception occurred\n");
apy3s_handle_exception("script_init");
- Py_DECREF(pHandler);
+ if (pHandler != NULL) {
+ Py_DECREF(pHandler);
+ }
goto error;
}
@@ -331,11 +333,10 @@ int apy3s_script_init_exec(PyObject* pModule, str *fname, int *vparam)
LM_ERR("PyObject_CallObject() returned NULL but no exception!\n");
if (!PyErr_Occurred())
PyErr_Format(PyExc_TypeError,
- "Function '%s' of module '%s' has returned not returned"
- " object. Should be a class instance.",
+ "Function '%s' of module '%s' has not returned"
+ " an object. Should be a class instance.",
fname->s, _sr_apy3s_bname);
apy3s_handle_exception("script_init");
- Py_DECREF(pHandler);
goto error;
}
Py_XDECREF(pHandler);