Module: kamailio Branch: master Commit: 569714ea692f751580d902900912caf3c56203dd URL: https://github.com/kamailio/kamailio/commit/569714ea692f751580d902900912caf3...
Author: Pantelis Kolatsis pk@gilawa.com Committer: Henning Westerholt hw@gilawa.com Date: 2023-04-21T17:58:01Z
sl: convert to memory logging helper
---
Modified: src/modules/sl/sl.c Modified: src/modules/sl/sl_funcs.c Modified: src/modules/sl/sl_stats.c
---
Diff: https://github.com/kamailio/kamailio/commit/569714ea692f751580d902900912caf3... Patch: https://github.com/kamailio/kamailio/commit/569714ea692f751580d902900912caf3...
---
diff --git a/src/modules/sl/sl.c b/src/modules/sl/sl.c index 746abeda80a..b9c667b42e4 100644 --- a/src/modules/sl/sl.c +++ b/src/modules/sl/sl.c @@ -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; } diff --git a/src/modules/sl/sl_funcs.c b/src/modules/sl/sl_funcs.c index 9b7a64b4299..29213a59633 100644 --- a/src/modules/sl/sl_funcs.c +++ b/src/modules/sl/sl_funcs.c @@ -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(); @@ -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; } @@ -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; @@ -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; }
diff --git a/src/modules/sl/sl_stats.c b/src/modules/sl/sl_stats.c index 9b7cf51259d..826fe544a86 100644 --- a/src/modules/sl/sl_stats.c +++ b/src/modules/sl/sl_stats.c @@ -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; @@ -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; }