Module: kamailio Branch: master Commit: 66ed074cc4e85dbd76483f09e6fec4ae3dc0eccb URL: https://github.com/kamailio/kamailio/commit/66ed074cc4e85dbd76483f09e6fec4ae...
Author: Victor Seva linuxmaniac@torreviejawireless.org Committer: Victor Seva linuxmaniac@torreviejawireless.org Date: 2018-12-28T15:59:58+01:00
app_python: use mem error macros
---
Modified: src/modules/app_python/apy_kemi.c Modified: src/modules/app_python/python_support.c
---
Diff: https://github.com/kamailio/kamailio/commit/66ed074cc4e85dbd76483f09e6fec4ae... Patch: https://github.com/kamailio/kamailio/commit/66ed074cc4e85dbd76483f09e6fec4ae...
---
diff --git a/src/modules/app_python/apy_kemi.c b/src/modules/app_python/apy_kemi.c index bcccbaa261..87e2ccce07 100644 --- a/src/modules/app_python/apy_kemi.c +++ b/src/modules/app_python/apy_kemi.c @@ -1342,7 +1342,7 @@ int apy_sr_init_mod(void) if(_sr_python_reload_version == NULL) { _sr_python_reload_version = (int*)shm_malloc(sizeof(int)); if(_sr_python_reload_version == NULL) { - LM_ERR("failed to allocated reload version\n"); + SHM_MEM_ERROR; return -1; } *_sr_python_reload_version = 0; diff --git a/src/modules/app_python/python_support.c b/src/modules/app_python/python_support.c index 7b1a93017e..7c4522eba6 100644 --- a/src/modules/app_python/python_support.c +++ b/src/modules/app_python/python_support.c @@ -94,8 +94,7 @@ void python_handle_exception(const char *fmt, ...) buf = (char *)pkg_realloc(NULL, buflen * sizeof(char)); if (!buf) { - LM_ERR("Can't allocate memory (%lu bytes), pkg_realloc() has failed." - " Not enough memory.\n", (unsigned long)(buflen * sizeof(char *))); + PKG_MEM_ERROR; if (srcbuf) pkg_free(srcbuf); return; } @@ -130,8 +129,7 @@ void python_handle_exception(const char *fmt, ...) buf = (char *)pkg_reallocxf(buf, buflen * sizeof(char)); if (!buf) { - LM_ERR("Can't allocate memory (%lu bytes), pkg_realloc() has failed." - " Not enough memory.\n", (unsigned long)(buflen * sizeof(char *))); + PKG_MEM_ERROR; Py_DECREF(line); Py_DECREF(pResult); if (srcbuf) pkg_free(srcbuf); @@ -200,8 +198,7 @@ static char *make_message(const char *fmt, va_list ap) p = (char *)pkg_realloc(NULL, size * sizeof(char)); if (!p) { - LM_ERR("Can't allocate memory (%lu bytes), pkg_malloc() has failed:" - " Not enough memory.\n", (unsigned long)(size * sizeof(char))); + PKG_MEM_ERROR; return NULL; } memset(p, 0, size * sizeof(char)); @@ -221,8 +218,7 @@ static char *make_message(const char *fmt, va_list ap) np = (char *)pkg_realloc(p, size * sizeof(char)); if (!np) { - LM_ERR("Can't allocate memory (%lu bytes), pkg_realloc() has failed:" - " Not enough memory.\n", (unsigned long)size * sizeof(char)); + PKG_MEM_ERROR; if (p) pkg_free(p); return NULL;