[sr-dev] git:master:1affa052: benchmark: use common error logging defines for memory allocation problems

Henning Westerholt hw at gilawa.com
Mon Jun 20 19:23:05 CEST 2022


Module: kamailio
Branch: master
Commit: 1affa052deb00885156c33538d081647d44e53d5
URL: https://github.com/kamailio/kamailio/commit/1affa052deb00885156c33538d081647d44e53d5

Author: Henning Westerholt <hw at gilawa.com>
Committer: Henning Westerholt <hw at gilawa.com>
Date: 2022-06-20T17:22:38Z

benchmark: use common error logging defines for memory allocation problems

---

Modified: src/modules/benchmark/benchmark.c

---

Diff:  https://github.com/kamailio/kamailio/commit/1affa052deb00885156c33538d081647d44e53d5.diff
Patch: https://github.com/kamailio/kamailio/commit/1affa052deb00885156c33538d081647d44e53d5.patch

---

diff --git a/src/modules/benchmark/benchmark.c b/src/modules/benchmark/benchmark.c
index a1d5f63ef0..cb1e288be1 100644
--- a/src/modules/benchmark/benchmark.c
+++ b/src/modules/benchmark/benchmark.c
@@ -220,7 +220,7 @@ static int bm_init_mycfg(void)
 	}
 	bm_mycfg = (bm_cfg_t*)shm_malloc(sizeof(bm_cfg_t));
 	if(bm_mycfg==NULL) {
-		LM_ERR("failed to allocated shared memory\n");
+		SHM_MEM_ERROR;
 		return -1;
 	}
 	memset(bm_mycfg, 0, sizeof(bm_cfg_t));
@@ -407,7 +407,7 @@ int _bm_register_timer(char *tname, int mode, unsigned int *id)
 
 	if(bmt==0)
 	{
-		LM_ERR("no more shm\n");
+		SHM_MEM_ERROR;
 		return -1;
 	}
 	memset(bmt, 0, sizeof(benchmark_timer_t));
@@ -417,7 +417,7 @@ int _bm_register_timer(char *tname, int mode, unsigned int *id)
 	if(bmt->start == NULL)
 	{
 		shm_free(bmt);
-		LM_ERR("no more pkg\n");
+		PKG_MEM_ERROR;
 		return -1;
 	}
 	memset(bmt->start, 0, sizeof(bm_timeval_t));
@@ -442,7 +442,7 @@ int _bm_register_timer(char *tname, int mode, unsigned int *id)
 								sizeof(benchmark_timer_t*));
 		if(bm_mycfg->tindex==0)
 		{
-			LM_ERR("no more share memory\n");
+			SHM_MEM_ERROR;
 			if(tidx!=0)
 				shm_free(tidx);
 			return -1;




More information about the sr-dev mailing list