Browse code

tmx: convert to memory logging helper

Henning Westerholt authored on 13/02/2020 22:00:39
Showing 2 changed files
... ...
@@ -117,7 +117,7 @@ int pv_t_update_req(struct sip_msg *msg)
117 117
 		_pv_treq.buf = (char*)pkg_malloc(_pv_treq.buf_size*sizeof(char));
118 118
 		if(_pv_treq.buf==NULL)
119 119
 		{
120
-			LM_ERR("no more pkg\n");
120
+			PKG_MEM_ERROR;
121 121
 			_pv_treq.buf_size = 0;
122 122
 			return -1;
123 123
 		}
... ...
@@ -195,7 +195,7 @@ int pv_t_update_rpl(struct sip_msg *msg)
195 195
 		_pv_trpl.buf = (char*)pkg_malloc(_pv_trpl.buf_size*sizeof(char));
196 196
 		if(_pv_trpl.buf==NULL)
197 197
 		{
198
-			LM_ERR("no more pkg\n");
198
+			PKG_MEM_ERROR;
199 199
 			_pv_trpl.buf_size = 0;
200 200
 			return -1;
201 201
 		}
... ...
@@ -263,7 +263,7 @@ int pv_t_update_inv(struct sip_msg *msg)
263 263
 		_pv_tinv.buf = (char*)pkg_malloc(_pv_tinv.buf_size*sizeof(char));
264 264
 		if(_pv_tinv.buf==NULL)
265 265
 		{
266
-			LM_ERR("no more pkg\n");
266
+			PKG_MEM_ERROR;
267 267
 			_pv_tinv.buf_size = 0;
268 268
 			goto error;
269 269
 		}
... ...
@@ -368,8 +368,10 @@ int pv_parse_t_var_name(pv_spec_p sp, str *in)
368 368
 		return -1;
369 369
 
370 370
 	pv = (pv_spec_t*)pkg_malloc(sizeof(pv_spec_t));
371
-	if(pv==NULL)
371
+	if(pv==NULL) {
372
+		PKG_MEM_ERROR;
372 373
 		return -1;
374
+	}
373 375
 
374 376
 	memset(pv, 0, sizeof(pv_spec_t));
375 377
 
... ...
@@ -89,7 +89,7 @@ int tmx_init_pretran_table(void)
89 89
 
90 90
 	_tmx_ptran_table = (pretran_slot_t*)shm_malloc(_tmx_ptran_size*sizeof(pretran_slot_t));
91 91
 	if(_tmx_ptran_table == NULL) {
92
-		LM_ERR("not enough shared memory\n");
92
+		SHM_MEM_ERROR;
93 93
 		return -1;
94 94
 	}
95 95
 	memset(_tmx_ptran_table, 0, _tmx_ptran_size*sizeof(pretran_slot_t));
... ...
@@ -249,7 +249,7 @@ int tmx_check_pretran(sip_msg_t *msg)
249 249
 	if(unlikely(_tmx_proc_ptran == NULL)) {
250 250
 		_tmx_proc_ptran = (pretran_t*)shm_malloc(sizeof(pretran_t));
251 251
 		if(_tmx_proc_ptran == NULL) {
252
-			LM_ERR("not enough memory for pretran structure\n");
252
+			SHM_MEM_ERROR_FMT("pretran structure\n");
253 253
 			return -1;
254 254
 		}
255 255
 		memset(_tmx_proc_ptran, 0, sizeof(pretran_t));
... ...
@@ -270,7 +270,7 @@ int tmx_check_pretran(sip_msg_t *msg)
270 270
 		if(_tmx_proc_ptran->dbuf.s) shm_free(_tmx_proc_ptran->dbuf.s);
271 271
 		_tmx_proc_ptran->dbuf.s = (char*)shm_malloc(dsize);
272 272
 		if(_tmx_proc_ptran->dbuf.s==NULL) {
273
-			LM_ERR("not enough memory for pretran data\n");
273
+			SHM_MEM_ERROR_FMT("pretran data\n");
274 274
 			return -1;
275 275
 		}
276 276
 		_tmx_proc_ptran->dbuf.len = dsize;