Skip to content

Commit

Permalink
app_lua: use mem error macros
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxmaniac committed Dec 28, 2018
1 parent 1fdc4be commit 37c95cb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/modules/app_lua/app_lua_api.c
Expand Up @@ -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);
Expand Down Expand Up @@ -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));
Expand Down Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/app_lua/app_lua_exp.c
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/modules/app_lua/app_lua_sr.c
Expand Up @@ -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]);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 37c95cb

Please sign in to comment.