Module: kamailio
Branch: master
Commit: 37c95cb4acf09daa4258003e8ddb0e0dc83c3937
URL:
https://github.com/kamailio/kamailio/commit/37c95cb4acf09daa4258003e8ddb0e0…
Author: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Committer: Victor Seva <linuxmaniac(a)torreviejawireless.org>
Date: 2018-12-28T15:50:27+01:00
app_lua: use mem error macros
---
Modified: src/modules/app_lua/app_lua_api.c
Modified: src/modules/app_lua/app_lua_exp.c
Modified: src/modules/app_lua/app_lua_sr.c
---
Diff:
https://github.com/kamailio/kamailio/commit/37c95cb4acf09daa4258003e8ddb0e0…
Patch:
https://github.com/kamailio/kamailio/commit/37c95cb4acf09daa4258003e8ddb0e0…
---
diff --git a/src/modules/app_lua/app_lua_api.c b/src/modules/app_lua/app_lua_api.c
index 8fe8a22569..68e079d648 100644
--- a/src/modules/app_lua/app_lua_api.c
+++ b/src/modules/app_lua/app_lua_api.c
@@ -81,14 +81,14 @@ int lua_sr_alloc_script_ver(void)
sr_lua_script_ver = (sr_lua_script_ver_t *) shm_malloc(sizeof(sr_lua_script_ver_t));
if(sr_lua_script_ver==NULL)
{
- LM_ERR("cannot allocate shm memory\n");
+ SHM_MEM_ERROR;
return -1;
}
sr_lua_script_ver->version = (unsigned int *) shm_malloc(sizeof(unsigned int)*size);
if(sr_lua_script_ver->version==NULL)
{
- LM_ERR("cannot allocate shm memory\n");
+ SHM_MEM_ERROR;
goto error;
}
memset(sr_lua_script_ver->version, 0, sizeof(unsigned int)*size);
@@ -136,7 +136,7 @@ int sr_lua_load_script(char *script)
li = (sr_lua_load_t*)pkg_malloc(sizeof(sr_lua_load_t));
if(li==NULL)
{
- LM_ERR("no more pkg\n");
+ PKG_MEM_ERROR;
return -1;
}
memset(li, 0, sizeof(sr_lua_load_t));
@@ -451,7 +451,7 @@ int sr_lua_reload_script(void)
_app_lua_sv = (int *) pkg_malloc(sizeof(int)*sv_len);
if(_app_lua_sv==NULL)
{
- LM_ERR("no more pkg memory\n");
+ PKG_MEM_ERROR;
return -1;
}
}
diff --git a/src/modules/app_lua/app_lua_exp.c b/src/modules/app_lua/app_lua_exp.c
index 7889a4eff1..1e512ec533 100644
--- a/src/modules/app_lua/app_lua_exp.c
+++ b/src/modules/app_lua/app_lua_exp.c
@@ -646,7 +646,7 @@ static int lua_sr_tm_t_on_branch_failure(lua_State *L)
{
if ((rt_name.s = pkg_reallocxf(rt_name.s, rt_name_len+1)) == NULL)
{
- LM_ERR("No memory left in branch_failure fixup\n");
+ PKG_MEM_ERROR;
return -1;
}
rt_name.len = rt_name_len;
diff --git a/src/modules/app_lua/app_lua_sr.c b/src/modules/app_lua/app_lua_sr.c
index 8009f2970a..6119aefa46 100644
--- a/src/modules/app_lua/app_lua_sr.c
+++ b/src/modules/app_lua/app_lua_sr.c
@@ -171,7 +171,7 @@ static int lua_sr_modf (lua_State *L)
argv[i] = (char*)pkg_malloc(strlen(luav[i])+1);
if(argv[i]==NULL)
{
- LM_ERR("no more pkg\n");
+ PKG_MEM_ERROR;
goto error;
}
strcpy(argv[i], luav[i]);
@@ -743,7 +743,7 @@ static int lua_sr_hdr_append (lua_State *L)
hdr = (char*)pkg_malloc(len+1);
if(hdr==NULL)
{
- LM_ERR("no pkg memory left\n");
+ PKG_MEM_ERROR;
return 0;
}
memcpy(hdr, txt, len);
@@ -829,7 +829,7 @@ static int lua_sr_hdr_insert (lua_State *L)
hdr = (char*)pkg_malloc(len+1);
if(hdr==NULL)
{
- LM_ERR("no pkg memory left\n");
+ PKG_MEM_ERROR;
return 0;
}
memcpy(hdr, txt, len);