Module: kamailio
Branch: master
Commit: d5ab93a1e642aec9c842c9ffe9cb712c0f41e4c0
URL:
https://github.com/kamailio/kamailio/commit/d5ab93a1e642aec9c842c9ffe9cb712…
Author: Pantelis Kolatsis <pk(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2023-04-24T19:08:29Z
statsc: convert to memory logging helper, free memory in case of error
---
Modified: src/modules/statsc/statsc_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/d5ab93a1e642aec9c842c9ffe9cb712…
Patch:
https://github.com/kamailio/kamailio/commit/d5ab93a1e642aec9c842c9ffe9cb712…
---
diff --git a/src/modules/statsc/statsc_mod.c b/src/modules/statsc/statsc_mod.c
index 3b636b81fc5..92447339151 100644
--- a/src/modules/statsc/statsc_mod.c
+++ b/src/modules/statsc/statsc_mod.c
@@ -202,7 +202,7 @@ int statsc_nmap_add(str *sname, str *rname)
+ STRLEN_ROUNDUP(sname->len) + STRLEN_ROUNDUP(rname->len);
sm = shm_malloc(sz);
if(sm==NULL) {
- LM_ERR("no more shared memory\n");
+ SHM_MEM_ERROR;
return -1;
}
memset(sm, 0, sz);
@@ -241,7 +241,7 @@ int statsc_init(void)
_statsc_info = shm_malloc(sizeof(statsc_info_t));
if(_statsc_info==NULL) {
- LM_ERR("no more shared memory\n");
+ SHM_MEM_ERROR;
return -1;
}
memset(_statsc_info, 0, sizeof(statsc_info_t));
@@ -250,7 +250,8 @@ int statsc_init(void)
sz = sizeof(statsc_nmap_t) + statsc_items * sizeof(int64_t);
sm = shm_malloc(sz);
if(sm==NULL) {
- LM_ERR("no more shared memory\n");
+ SHM_MEM_ERROR;
+ shm_free(_statsc_info);
return -1;
}
memset(sm, 0, sz);