Module: kamailio
Branch: master
Commit: a404f598dce129cdd3d73dd0e79e011e0948b0c1
URL:
https://github.com/kamailio/kamailio/commit/a404f598dce129cdd3d73dd0e79e011…
Author: Henning Westerholt <hw(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2025-01-10T16:11:26Z
xhttp_prom: free memory in case of startup problems, use standard memory log helper
---
Modified: src/modules/xhttp_prom/xhttp_prom.c
---
Diff:
https://github.com/kamailio/kamailio/commit/a404f598dce129cdd3d73dd0e79e011…
Patch:
https://github.com/kamailio/kamailio/commit/a404f598dce129cdd3d73dd0e79e011…
---
diff --git a/src/modules/xhttp_prom/xhttp_prom.c b/src/modules/xhttp_prom/xhttp_prom.c
index 247b349ee5b..73cc29d58c3 100644
--- a/src/modules/xhttp_prom/xhttp_prom.c
+++ b/src/modules/xhttp_prom/xhttp_prom.c
@@ -304,7 +304,7 @@ static int mod_init(void)
size_t len_comma = xhttp_prom_tags.len + 4;
xhttp_prom_tags_comma = shm_malloc(len_comma);
if(xhttp_prom_tags_comma == NULL) {
- LM_ERR("cannot allocate memory for helper variable\n");
+ SHM_MEM_ERROR;
return -1;
}
memset(xhttp_prom_tags_comma, 0, len_comma);
@@ -314,7 +314,8 @@ static int mod_init(void)
size_t len_braces = xhttp_prom_tags.len + 4;
xhttp_prom_tags_braces = shm_malloc(len_braces);
if(xhttp_prom_tags_braces == NULL) {
- LM_ERR("cannot allocate memory for helper variable\n");
+ SHM_MEM_ERROR;
+ shm_free(xhttp_prom_tags_comma);
return -1;
}
memset(xhttp_prom_tags_braces, 0, len_braces);