Module: kamailio
Branch: master
Commit: ea31785f3458bb79d14384734f8fd4f7b628ffa2
URL:
https://github.com/kamailio/kamailio/commit/ea31785f3458bb79d14384734f8fd4f…
Author: Pantelis Kolatsis <pk(a)gilawa.com>
Committer: Henning Westerholt <hw(a)gilawa.com>
Date: 2023-04-29T19:16:32Z
ldap: convert to memory error logging helper
---
Modified: src/modules/ldap/ld_session.c
Modified: src/modules/ldap/ldap_mod.c
---
Diff:
https://github.com/kamailio/kamailio/commit/ea31785f3458bb79d14384734f8fd4f…
Patch:
https://github.com/kamailio/kamailio/commit/ea31785f3458bb79d14384734f8fd4f…
---
diff --git a/src/modules/ldap/ld_session.c b/src/modules/ldap/ld_session.c
index ad0c9a793bf..222d504ed1b 100644
--- a/src/modules/ldap/ld_session.c
+++ b/src/modules/ldap/ld_session.c
@@ -43,7 +43,7 @@ int add_ld_session(char *_name, LDAP *_ldh, dictionary *_d)
new_lds = (struct ld_session *)pkg_malloc(sizeof(struct ld_session));
if(new_lds == NULL) {
- LM_ERR("no memory\n");
+ PKG_MEM_ERROR;
return -1;
}
memset(new_lds, 0, sizeof(struct ld_session));
@@ -58,7 +58,7 @@ int add_ld_session(char *_name, LDAP *_ldh, dictionary *_d)
_d, get_ini_key_name(_name, CFG_N_LDAP_HOST), CFG_DEF_HOST_NAME);
new_lds->host_name = (char *)pkg_malloc(strlen(host_name) + 1);
if(new_lds->host_name == NULL) {
- LM_ERR("no memory\n");
+ PKG_MEM_ERROR;
pkg_free(new_lds);
return -1;
}
@@ -104,7 +104,7 @@ int add_ld_session(char *_name, LDAP *_ldh, dictionary *_d)
get_ini_key_name(_name, CFG_N_LDAP_BIND_DN), CFG_DEF_LDAP_BIND_DN);
new_lds->bind_dn = (char *)pkg_malloc(strlen(bind_dn) + 1);
if(new_lds->bind_dn == NULL) {
- LM_ERR("no memory\n");
+ PKG_MEM_ERROR;
pkg_free(new_lds->host_name);
pkg_free(new_lds);
return -1;
@@ -117,7 +117,7 @@ int add_ld_session(char *_name, LDAP *_ldh, dictionary *_d)
CFG_DEF_LDAP_BIND_PWD);
new_lds->bind_pwd = (char *)pkg_malloc(strlen(bind_pwd) + 1);
if(new_lds->bind_pwd == NULL) {
- LM_ERR("no memory\n");
+ PKG_MEM_ERROR;
pkg_free(new_lds->bind_dn);
pkg_free(new_lds->host_name);
pkg_free(new_lds);
diff --git a/src/modules/ldap/ldap_mod.c b/src/modules/ldap/ldap_mod.c
index 1fea95e458d..757d3594718 100644
--- a/src/modules/ldap/ldap_mod.c
+++ b/src/modules/ldap/ldap_mod.c
@@ -328,7 +328,7 @@ static int ldap_result_fixup(void **param, int param_no)
lp = (struct ldap_result_params *)pkg_malloc(
sizeof(struct ldap_result_params));
if(lp == NULL) {
- LM_ERR("no memory\n");
+ PKG_MEM_ERROR;
return E_OUT_OF_MEM;
}
memset(lp, 0, sizeof(struct ldap_result_params));
@@ -388,7 +388,7 @@ static int ldap_result_check_fixup(void **param, int param_no)
lp = (struct ldap_result_check_params *)pkg_malloc(
sizeof(struct ldap_result_check_params));
if(lp == NULL) {
- LM_ERR("no memory\n");
+ PKG_MEM_ERROR;
return E_OUT_OF_MEM;
}
memset(lp, 0, sizeof(struct ldap_result_check_params));
@@ -444,7 +444,7 @@ static int ldap_filter_url_encode_fixup(void **param, int param_no)
} else if(param_no == 2) {
spec_p = (pv_spec_t *)pkg_malloc(sizeof(pv_spec_t));
if(spec_p == NULL) {
- LM_ERR("no memory\n");
+ PKG_MEM_ERROR;
return E_OUT_OF_MEM;
}
s.s = (char *)*param;