Module: kamailio
Branch: master
Commit: 01e82b38c41d344c1e94b2e0f574981ef0ce4318
URL:
https://github.com/kamailio/kamailio/commit/01e82b38c41d344c1e94b2e0f574981…
Author: Pantelis Kolatsis <pk(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2023-03-22T10:07:02Z
auth_db: fix goto for memory allocation error, convert to memory logging helper
---
Modified: src/modules/auth_db/auth_db_mod.c
Modified: src/modules/auth_db/authorize.c
---
Diff:
https://github.com/kamailio/kamailio/commit/01e82b38c41d344c1e94b2e0f574981…
Patch:
https://github.com/kamailio/kamailio/commit/01e82b38c41d344c1e94b2e0f574981…
---
diff --git a/src/modules/auth_db/auth_db_mod.c b/src/modules/auth_db/auth_db_mod.c
index ce8baae8381..5d54bdf4bd4 100644
--- a/src/modules/auth_db/auth_db_mod.c
+++ b/src/modules/auth_db/auth_db_mod.c
@@ -359,7 +359,7 @@ int parse_aaa_pvs(char *definition, pv_elem_t **pv_def, int *cnt)
while ( (end=strchr(p,';'))!=0 || (end=p+strlen(p))!=p ) {
/* new pv_elem_t */
if ( (pve=(pv_elem_t*)pkg_malloc(sizeof(pv_elem_t)))==0 ) {
- LM_ERR("no more pkg mem\n");
+ PKG_MEM_ERROR;
goto error;
}
memset( pve, 0, sizeof(pv_elem_t));
@@ -394,8 +394,8 @@ int parse_aaa_pvs(char *definition, pv_elem_t **pv_def, int *cnt)
/* create an avp definition for the spec parser */
pv.s = (char*)pkg_malloc(pve->text.len + 7);
if (pv.s == NULL) {
- LM_ERR("no more pkg mem\n");
- goto parse_error;
+ PKG_MEM_ERROR;
+ goto error;
}
pv.len = snprintf(pv.s, pve->text.len + 7, "$avp(%.*s)",
pve->text.len, pve->text.s);
diff --git a/src/modules/auth_db/authorize.c b/src/modules/auth_db/authorize.c
index 4f8d9674549..dfaf8f92bbf 100644
--- a/src/modules/auth_db/authorize.c
+++ b/src/modules/auth_db/authorize.c
@@ -59,7 +59,7 @@ int fetch_credentials(sip_msg_t *msg, str *user, str* domain, str
*table, int fl
}
col = pkg_malloc(sizeof(*col) * (nc+1));
if (col == NULL) {
- LM_ERR("no more pkg memory\n");
+ PKG_MEM_ERROR;
return -1;
}
@@ -140,7 +140,7 @@ static inline int get_ha1(struct username* _username, str* _domain,
col = pkg_malloc(sizeof(*col) * (credentials_n + 1));
if (col == NULL) {
- LM_ERR("no more pkg memory\n");
+ PKG_MEM_ERROR;
return -1;
}