Module: kamailio
Branch: master
Commit: 5357de9c0af801876fec6dab00276c3aa29a87e4
URL:
https://github.com/kamailio/kamailio/commit/5357de9c0af801876fec6dab00276c3…
Author: Henning Westerholt <hw(a)skalatan.de>
Committer: Henning Westerholt <hw(a)skalatan.de>
Date: 2020-02-13T23:08:35+01:00
usrloc: convert to memory logging helper
---
Modified: src/modules/usrloc/dlist.c
Modified: src/modules/usrloc/ucontact.c
Modified: src/modules/usrloc/udomain.c
Modified: src/modules/usrloc/ul_callback.c
Modified: src/modules/usrloc/urecord.c
---
Diff:
https://github.com/kamailio/kamailio/commit/5357de9c0af801876fec6dab00276c3…
Patch:
https://github.com/kamailio/kamailio/commit/5357de9c0af801876fec6dab00276c3…
---
diff --git a/src/modules/usrloc/dlist.c b/src/modules/usrloc/dlist.c
index 5148c9d6f0..a4c838e1f6 100644
--- a/src/modules/usrloc/dlist.c
+++ b/src/modules/usrloc/dlist.c
@@ -556,7 +556,7 @@ static inline int new_dlist(str* _n, dlist_t** _d)
*/
ptr = (dlist_t*)shm_malloc(sizeof(dlist_t));
if (ptr == 0) {
- LM_ERR("no more share memory\n");
+ SHM_MEM_ERROR;
return -1;
}
memset(ptr, 0, sizeof(dlist_t));
@@ -564,7 +564,7 @@ static inline int new_dlist(str* _n, dlist_t** _d)
/* copy domain name as null terminated string */
ptr->name.s = (char*)shm_malloc(_n->len+1);
if (ptr->name.s == 0) {
- LM_ERR("no more memory left\n");
+ SHM_MEM_ERROR;
shm_free(ptr);
return -2;
}
diff --git a/src/modules/usrloc/ucontact.c b/src/modules/usrloc/ucontact.c
index fe04d2af3d..c95cbb0dd7 100644
--- a/src/modules/usrloc/ucontact.c
+++ b/src/modules/usrloc/ucontact.c
@@ -95,7 +95,7 @@ ucontact_t* new_ucontact(str* _dom, str* _aor, str* _contact,
ucontact_info_t* _
c = (ucontact_t*)shm_malloc(sizeof(ucontact_t));
if (!c) {
- LM_ERR("no more shm memory\n");
+ SHM_MEM_ERROR;
return 0;
}
memset(c, 0, sizeof(ucontact_t));
@@ -138,7 +138,7 @@ ucontact_t* new_ucontact(str* _dom, str* _aor, str* _contact,
ucontact_info_t* _
return c;
error:
- LM_ERR("no more shm memory\n");
+ SHM_MEM_ERROR;
if (c->path.s) shm_free(c->path.s);
if (c->received.s) shm_free(c->received.s);
if (c->user_agent.s) shm_free(c->user_agent.s);
@@ -245,7 +245,7 @@ int mem_update_ucontact(ucontact_t* _c, ucontact_info_t* _ci)
if ((_old)->len < (_new)->len) { \
ptr = (char*)shm_malloc((_new)->len); \
if (ptr == 0) { \
- LM_ERR("no more shm memory\n"); \
+ SHM_MEM_ERROR; \
return -1; \
}\
memcpy(ptr, (_new)->s, (_new)->len);\
diff --git a/src/modules/usrloc/udomain.c b/src/modules/usrloc/udomain.c
index 80980c4cdf..8050a21ce5 100644
--- a/src/modules/usrloc/udomain.c
+++ b/src/modules/usrloc/udomain.c
@@ -55,7 +55,7 @@ static char *build_stat_name( str* domain, char *var_name)
n = domain->len + 1 + strlen(var_name) + 1;
s = (char*)shm_malloc( n );
if (s==0) {
- LM_ERR("no more shm mem\n");
+ SHM_MEM_ERROR;
return 0;
}
memcpy( s, domain->s, domain->len);
@@ -90,14 +90,14 @@ int new_udomain(str* _n, int _s, udomain_t** _d)
*/
*_d = (udomain_t*)shm_malloc(sizeof(udomain_t));
if (!(*_d)) {
- LM_ERR("new_udomain(): No memory left\n");
+ SHM_MEM_ERROR;
goto error0;
}
memset(*_d, 0, sizeof(udomain_t));
(*_d)->table = (hslot_t*)shm_malloc(sizeof(hslot_t) * _s);
if (!(*_d)->table) {
- LM_ERR("no memory left 2\n");
+ SHM_MEM_ERROR;
goto error1;
}
diff --git a/src/modules/usrloc/ul_callback.c b/src/modules/usrloc/ul_callback.c
index d00a7ddb40..a3f028b15d 100644
--- a/src/modules/usrloc/ul_callback.c
+++ b/src/modules/usrloc/ul_callback.c
@@ -44,7 +44,7 @@ int init_ulcb_list(void)
ulcb_list = (struct ulcb_head_list*)shm_malloc
( sizeof(struct ulcb_head_list) );
if (ulcb_list==0) {
- LM_CRIT("no more shared mem\n");
+ SHM_MEM_CRITICAL;
return -1;
}
ulcb_list->first = 0;
@@ -92,7 +92,7 @@ int register_ulcb( int types, ul_cb f, void *param )
/* build a new callback structure */
if (!(cbp=(struct ul_callback*)shm_malloc(sizeof( struct ul_callback)))) {
- LM_ERR("no more share mem\n");
+ SHM_MEM_ERROR;
return E_OUT_OF_MEM;
}
diff --git a/src/modules/usrloc/urecord.c b/src/modules/usrloc/urecord.c
index e8e595d74d..afed194734 100644
--- a/src/modules/usrloc/urecord.c
+++ b/src/modules/usrloc/urecord.c
@@ -57,14 +57,14 @@ int new_urecord(str* _dom, str* _aor, urecord_t** _r)
{
*_r = (urecord_t*)shm_malloc(sizeof(urecord_t));
if (*_r == 0) {
- LM_ERR("no more share memory\n");
+ SHM_MEM_ERROR;
return -1;
}
memset(*_r, 0, sizeof(urecord_t));
(*_r)->aor.s = (char*)shm_malloc(_aor->len);
if ((*_r)->aor.s == 0) {
- LM_ERR("no more share memory\n");
+ SHM_MEM_ERROR;
shm_free(*_r);
*_r = 0;
return -2;