Module: kamailio
Branch: master
Commit: e1f1b3a5e55e05a80af4e2ef91fac42892211c08
URL:
https://github.com/kamailio/kamailio/commit/e1f1b3a5e55e05a80af4e2ef91fac42…
Author: Henning Westerholt <hw(a)skalatan.de>
Committer: Henning Westerholt <hw(a)skalatan.de>
Date: 2020-02-13T23:08:35+01:00
tmx: convert to memory logging helper
---
Modified: src/modules/tmx/t_var.c
Modified: src/modules/tmx/tmx_pretran.c
---
Diff:
https://github.com/kamailio/kamailio/commit/e1f1b3a5e55e05a80af4e2ef91fac42…
Patch:
https://github.com/kamailio/kamailio/commit/e1f1b3a5e55e05a80af4e2ef91fac42…
---
diff --git a/src/modules/tmx/t_var.c b/src/modules/tmx/t_var.c
index 1f83eca50d..15938fcd9e 100644
--- a/src/modules/tmx/t_var.c
+++ b/src/modules/tmx/t_var.c
@@ -117,7 +117,7 @@ int pv_t_update_req(struct sip_msg *msg)
_pv_treq.buf = (char*)pkg_malloc(_pv_treq.buf_size*sizeof(char));
if(_pv_treq.buf==NULL)
{
- LM_ERR("no more pkg\n");
+ PKG_MEM_ERROR;
_pv_treq.buf_size = 0;
return -1;
}
@@ -195,7 +195,7 @@ int pv_t_update_rpl(struct sip_msg *msg)
_pv_trpl.buf = (char*)pkg_malloc(_pv_trpl.buf_size*sizeof(char));
if(_pv_trpl.buf==NULL)
{
- LM_ERR("no more pkg\n");
+ PKG_MEM_ERROR;
_pv_trpl.buf_size = 0;
return -1;
}
@@ -263,7 +263,7 @@ int pv_t_update_inv(struct sip_msg *msg)
_pv_tinv.buf = (char*)pkg_malloc(_pv_tinv.buf_size*sizeof(char));
if(_pv_tinv.buf==NULL)
{
- LM_ERR("no more pkg\n");
+ PKG_MEM_ERROR;
_pv_tinv.buf_size = 0;
goto error;
}
@@ -368,8 +368,10 @@ int pv_parse_t_var_name(pv_spec_p sp, str *in)
return -1;
pv = (pv_spec_t*)pkg_malloc(sizeof(pv_spec_t));
- if(pv==NULL)
+ if(pv==NULL) {
+ PKG_MEM_ERROR;
return -1;
+ }
memset(pv, 0, sizeof(pv_spec_t));
diff --git a/src/modules/tmx/tmx_pretran.c b/src/modules/tmx/tmx_pretran.c
index 67c4f7f4af..256c82bf16 100644
--- a/src/modules/tmx/tmx_pretran.c
+++ b/src/modules/tmx/tmx_pretran.c
@@ -89,7 +89,7 @@ int tmx_init_pretran_table(void)
_tmx_ptran_table = (pretran_slot_t*)shm_malloc(_tmx_ptran_size*sizeof(pretran_slot_t));
if(_tmx_ptran_table == NULL) {
- LM_ERR("not enough shared memory\n");
+ SHM_MEM_ERROR;
return -1;
}
memset(_tmx_ptran_table, 0, _tmx_ptran_size*sizeof(pretran_slot_t));
@@ -249,7 +249,7 @@ int tmx_check_pretran(sip_msg_t *msg)
if(unlikely(_tmx_proc_ptran == NULL)) {
_tmx_proc_ptran = (pretran_t*)shm_malloc(sizeof(pretran_t));
if(_tmx_proc_ptran == NULL) {
- LM_ERR("not enough memory for pretran structure\n");
+ SHM_MEM_ERROR_FMT("pretran structure\n");
return -1;
}
memset(_tmx_proc_ptran, 0, sizeof(pretran_t));
@@ -270,7 +270,7 @@ int tmx_check_pretran(sip_msg_t *msg)
if(_tmx_proc_ptran->dbuf.s) shm_free(_tmx_proc_ptran->dbuf.s);
_tmx_proc_ptran->dbuf.s = (char*)shm_malloc(dsize);
if(_tmx_proc_ptran->dbuf.s==NULL) {
- LM_ERR("not enough memory for pretran data\n");
+ SHM_MEM_ERROR_FMT("pretran data\n");
return -1;
}
_tmx_proc_ptran->dbuf.len = dsize;