Module: kamailio
Branch: master
Commit: 49b3b90cd229b7c4da06b61cdfd782450d383cc9
URL:
https://github.com/kamailio/kamailio/commit/49b3b90cd229b7c4da06b61cdfd7824…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: 2023-12-13T12:23:23+01:00
app_python3: check allocated pointer
---
Modified: src/modules/app_python3/apy_kemi.c
---
Diff:
https://github.com/kamailio/kamailio/commit/49b3b90cd229b7c4da06b61cdfd7824…
Patch:
https://github.com/kamailio/kamailio/commit/49b3b90cd229b7c4da06b61cdfd7824…
---
diff --git a/src/modules/app_python3/apy_kemi.c b/src/modules/app_python3/apy_kemi.c
index 2d271b2e271..718d8ecedaf 100644
--- a/src/modules/app_python3/apy_kemi.c
+++ b/src/modules/app_python3/apy_kemi.c
@@ -567,6 +567,12 @@ static PyObject *init_KSR(void)
emods[k].kexp[0].mname.s);
PyModuleDef *mmodule = malloc(sizeof(PyModuleDef));
+ if(mmodule == NULL) {
+ LM_ERR("failed to allocate system memory\n");
+ free(_sr_KSRMethods);
+ _sr_KSRMethods = NULL;
+ return NULL;
+ }
memset(mmodule, 0, sizeof(PyModuleDef));
mmodule->m_name = strndup(mname, 127);
mmodule->m_methods = _sr_crt_KSRMethods;