浏览代码

ldap: convert to memory error logging helper

Pantelis Kolatsis 2 年之前
父节点
当前提交
ea31785f34
共有 2 个文件被更改,包括 7 次插入7 次删除
  1. 4 4
      src/modules/ldap/ld_session.c
  2. 3 3
      src/modules/ldap/ldap_mod.c

+ 4 - 4
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);

+ 3 - 3
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;