From 569714ea692f751580d902900912caf3c56203dd Mon Sep 17 00:00:00 2001 From: Pantelis Kolatsis Date: Fri, 21 Apr 2023 17:58:01 +0000 Subject: [PATCH] sl: convert to memory logging helper --- src/modules/sl/sl.c | 2 +- src/modules/sl/sl_funcs.c | 10 +++++----- src/modules/sl/sl_stats.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) 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; }