Skip to content

Commit

Permalink
sl: convert to memory logging helper
Browse files Browse the repository at this point in the history
  • Loading branch information
pantelisk98 authored and henningw committed Apr 21, 2023
1 parent 4753296 commit 569714e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/modules/sl/sl.c
Expand Up @@ -498,7 +498,7 @@ static int w_sl_forward_reply(sip_msg_t* msg, str* code, str* reason)
}
rbuf = (char *)pkg_malloc(reason->len);
if (rbuf==NULL) {
LM_ERR("not enough memory\n");
PKG_MEM_ERROR;
ret = -1;
goto restore;
}
Expand Down
10 changes: 5 additions & 5 deletions src/modules/sl/sl_funcs.c
Expand Up @@ -90,7 +90,7 @@ int sl_startup()
sl_timeout = (unsigned int*)shm_malloc(sizeof(unsigned int));
if (!sl_timeout)
{
LM_ERR("no more free memory!\n");
SHM_MEM_ERROR;
return -1;
}
*(sl_timeout)=get_ticks_raw();
Expand Down Expand Up @@ -244,13 +244,13 @@ int sl_reply_helper(struct sip_msg *msg, int code, char *reason, str *tag)

if ((hf = (hdr_field_t*) pkg_malloc(sizeof(struct hdr_field))) == NULL)
{
LM_ERR("out of package memory\n");
PKG_MEM_ERROR;
goto event_route_error;
}

if ((cseqb = (struct cseq_body *) pkg_malloc(sizeof(struct cseq_body))) == NULL)
{
LM_ERR("out of package memory\n");
PKG_MEM_ERROR;
pkg_free(hf);
goto event_route_error;
}
Expand All @@ -259,7 +259,7 @@ int sl_reply_helper(struct sip_msg *msg, int code, char *reason, str *tag)
* (msg->first_line.u.request.method.len + 5);
if ((tmp = (char *) pkg_malloc(tsize)) == NULL)
{
LM_ERR("out of package memory\n");
PKG_MEM_ERROR;
pkg_free(cseqb);
pkg_free(hf);
goto event_route_error;
Expand Down Expand Up @@ -518,7 +518,7 @@ int sl_register_callback(sl_cbelem_t *cbe)
p1 = (sl_cbelem_t*)pkg_malloc(sizeof(sl_cbelem_t));

if(p1==NULL) {
LM_ERR("no more pkg\n");
PKG_MEM_ERROR;
return -1;
}

Expand Down
4 changes: 2 additions & 2 deletions src/modules/sl/sl_stats.c
Expand Up @@ -109,7 +109,7 @@ int init_sl_stats(void)
{
sl_stats = (struct sl_stats**)shm_malloc(sizeof(struct sl_stats*));
if (!sl_stats) {
ERR("Unable to allocated shared memory for sl statistics\n");
SHM_MEM_ERROR_FMT("for sl statistics\n");
return -1;
}
*sl_stats = 0;
Expand All @@ -124,7 +124,7 @@ int init_sl_stats_child(void)
len = sizeof(struct sl_stats) * get_max_procs();
*sl_stats = shm_malloc(len);
if (*sl_stats == 0) {
ERR("No shmem\n");
SHM_MEM_ERROR;
shm_free(sl_stats);
return -1;
}
Expand Down

0 comments on commit 569714e

Please sign in to comment.